IamMax420
IamMax420
Explore posts from servers
JCHJava Community | Help. Code. Learn.
Created by IamMax420 on 1/22/2025 in #java-help
Lombok @Data error
I'm getting this error
java: cannot find symbol
symbol: method getFirstName()
location: variable customerDto of type dto.CustomerDto
java: cannot find symbol
symbol: method getFirstName()
location: variable customerDto of type dto.CustomerDto
in this part of code:
private Customer mapToCustomer(CustomerDto customerDto) throws Exception {
if(customerDto.getFirstName().isEmpty() || customerDto.getLastName().isEmpty() || customerDto.getEmail().isEmpty() || customerDto.getPassword().isEmpty() || customerDto.getRole().isEmpty()) {
throw new Exception("All fields must be filled");
}

return Customer.builder()
.firstName(customerDto.getFirstName())
.lastName(customerDto.getLastName())
.email(customerDto.getEmail())
.password(customerDto.getPassword())
.role(customerDto.getRole())
.build();
}
private Customer mapToCustomer(CustomerDto customerDto) throws Exception {
if(customerDto.getFirstName().isEmpty() || customerDto.getLastName().isEmpty() || customerDto.getEmail().isEmpty() || customerDto.getPassword().isEmpty() || customerDto.getRole().isEmpty()) {
throw new Exception("All fields must be filled");
}

return Customer.builder()
.firstName(customerDto.getFirstName())
.lastName(customerDto.getLastName())
.email(customerDto.getEmail())
.password(customerDto.getPassword())
.role(customerDto.getRole())
.build();
}
even though I've used the @Data annotation in my CustomerDto class:
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CustomerDto {
private Long id;
private String firstName;
private String lastName;
private String role;
private String email;
private String password;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CustomerDto {
private Long id;
private String firstName;
private String lastName;
private String role;
private String email;
private String password;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
}
17 replies
JCHJava Community | Help. Code. Learn.
Created by IamMax420 on 1/16/2025 in #java-help
stripe dependency not being recognized?
No description
41 replies
JCHJava Community | Help. Code. Learn.
Created by IamMax420 on 12/7/2024 in #java-help
java: cannot find symbol symbol: method builder()
before you ask, I've already enabled annotation processing in my spring boot project. I don't really know what else I can do
157 replies
CC#
Created by IamMax420 on 6/26/2024 in #help
Log in system error
I was trying to make a log in system for my web app, but my code doesn't seem to work using AplikacjaWeb.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; namespace AplikacjaWeb.Pages.Registration { public class RegistrationModel : PageModel { private readonly UserManager<UserModel> _userManager; private readonly SignInManager<UserModel> _signInManager; public RegistrationModel(UserManager<UserModel> userManager, SignInManager<UserModel> signInManager) { _userManager = userManager; _signInManager = signInManager; } [BindProperty] public Rejestracja /*Registration in english*/ Input { get; set; } public void OnGet() { } public async Task<IActionResult> OnPostAsync() { if (ModelState.IsValid) { var user = new UserModel { UserName = Input.Username, Email = Input.Email, PasswordHash = Input.Password }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { await _signInManager.SignInAsync(user, isPersistent: false); return RedirectToPage("/Index"); } else { Console.WriteLine("Error"); } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } return RedirectToPage("/Index"); } } }
13 replies
CC#
Created by IamMax420 on 6/6/2024 in #help
object ref not set blah blah blah
atp i have no Idea what I did wrong. In the following function: public async Task<IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return Page(); } var result = await _signInManager.PasswordSignInAsync(Input1.Username, Input1.Password, false, false); if (result.Succeeded) { return RedirectToPage("/Index"); } else { ModelState.AddModelError(string.Empty, "Invalid login attempt."); return Page(); } } the PasswordManagerAsync() method is throwing the aforementioned exception
3 replies
CC#
Created by IamMax420 on 5/25/2024 in #help
Problem with creating a project
No description
3 replies
CC#
Created by IamMax420 on 5/22/2024 in #help
I'm getting an error "object reference not set to an instance of an object"
the code: @model IEnumerable<WebApp.Models.Produkt> <h1>a List</h1> @if (Model == null || !Model.Any()) { <p>No products available.</p> } else { @foreach (var product in Model) { if (product != null) { <li> <b>@product.name</b> - @product.category <a href="@Url.Action("Details", "Warehouse", new { id = product.id })">Details</a> <button>Delete</button> </li> } } } It appears that Model is null but I don't know how to fix it
13 replies
CC#
Created by IamMax420 on 5/8/2024 in #help
what does assembly mean c#-wise ?
basically the question
7 replies
CC#
Created by IamMax420 on 5/7/2024 in #help
✅ why is the random number not being printed to the console?
No description
58 replies
CC#
Created by IamMax420 on 5/7/2024 in #help
why is there "string[] args" inside the main function parentheses?
Hello, I've just started learning c# (after doing some c++) and I wonder why it's like that since we don't even use it inside the main function, like it's just there and I'd like to know why
11 replies