Cydo
Cydo
Explore posts from servers
CC#
Created by Cydo on 9/16/2024 in #help
✅ Having trouble handling errors when registering a new user
Alright ill do that thanks.
6 replies
CC#
Created by Cydo on 9/16/2024 in #help
✅ Having trouble handling errors when registering a new user
So instead pass something like ErrorCodes.InvalidEmailFormat, and then on the front end have a look up table that will look for that error code and have the custom error message like "Email must in the correct format"
6 replies
CC#
Created by Cydo on 9/16/2024 in #help
✅ Having trouble handling errors when registering a new user
I think I might have come up with a viable solution where I create a my own exception and then deliberately check for the error message and throw that error
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Questlog.Application.Common.Exceptions
{
public class InvalidEmailFormatException : Exception
{
public Dictionary<string, List<string>> Errors { get; }
public InvalidEmailFormatException(Dictionary<string, List<string>> errors)
: base("Incorrect Email Format")
{
Errors = errors;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Questlog.Application.Common.Exceptions
{
public class InvalidEmailFormatException : Exception
{
public Dictionary<string, List<string>> Errors { get; }
public InvalidEmailFormatException(Dictionary<string, List<string>> errors)
: base("Incorrect Email Format")
{
Errors = errors;
}
}
}
var result = await _userManager.CreateAsync(user, registerRequestDTO.Password);

if (result.Succeeded)
{
var loginRequestDTO = new LoginRequestDTO
{
Email = registerRequestDTO.Email,
Password = registerRequestDTO.Password,

};

return await Login(loginRequestDTO);
}
else
{
var errors = new Dictionary<string, List<string>>();
foreach (var error in result.Errors)
{
if (error.Code.Contains("UserName"))
{
errors.Add("Email", new List<string> { error.Description });
}
}

throw new InvalidEmailFormatException(errors);

//var errors = string.Join(", ", result.Errors.Select(e => e.Description));
//throw new InvalidOperationException(errors);
}
var result = await _userManager.CreateAsync(user, registerRequestDTO.Password);

if (result.Succeeded)
{
var loginRequestDTO = new LoginRequestDTO
{
Email = registerRequestDTO.Email,
Password = registerRequestDTO.Password,

};

return await Login(loginRequestDTO);
}
else
{
var errors = new Dictionary<string, List<string>>();
foreach (var error in result.Errors)
{
if (error.Code.Contains("UserName"))
{
errors.Add("Email", new List<string> { error.Description });
}
}

throw new InvalidEmailFormatException(errors);

//var errors = string.Join(", ", result.Errors.Select(e => e.Description));
//throw new InvalidOperationException(errors);
}
I am all ears if there is a better solution then this though
6 replies
CC#
Created by Cydo on 9/14/2024 in #help
✅ How to hide sensitive data, like database credentials api keys etc
I should of kept reading, my apologies I am dumb
16 replies
CC#
Created by Cydo on 9/14/2024 in #help
✅ How to hide sensitive data, like database credentials api keys etc
Ok now this is a real dumb question, inside of visual studio theres no terminal like vs code, u have this package manager console and then the developer terminal, is that going to the same thing as using windows terminal?
16 replies
CC#
Created by Cydo on 9/14/2024 in #help
✅ How to hide sensitive data, like database credentials api keys etc
I think ill opt for that when I get this project completed, im just trying to spruce up my resume and get some interviews lol.
16 replies
CC#
Created by Cydo on 9/14/2024 in #help
✅ How to hide sensitive data, like database credentials api keys etc
No description
16 replies
CC#
Created by Cydo on 9/14/2024 in #help
✅ How to hide sensitive data, like database credentials api keys etc
yeah, aws at least had a 1 year free tier when i learned that for node and react, i just terminated my account at the 1 year mark tho lol
16 replies
CC#
Created by Cydo on 9/14/2024 in #help
✅ How to hide sensitive data, like database credentials api keys etc
But the rest will? My fear is I make a little portfolio app host it for 5$ or w.e the lowest fee is on azure and them somehow i get a bill that is thousands of dollars with out knowing how that even happened lol
16 replies
CC#
Created by Cydo on 9/6/2024 in #help
✅ What is considered enough knowledge to start applying?
Ive been learning .NET 8, so ive only touched modern .NET, DI seemed similar to Spring Boot which I did in college so that wasnt too crazy to pick up
25 replies
CC#
Created by Cydo on 9/6/2024 in #help
✅ What is considered enough knowledge to start applying?
is OTEL .NET observability with OpenTelemetry?
25 replies
CC#
Created by Cydo on 9/6/2024 in #help
✅ What is considered enough knowledge to start applying?
What about the language overall? I understand fundamentals, and OOP, but then C# has multithreading, async await, delegates, projects, assemblies, solutions, and then theres other topics such as Unit Testing, Deployment, CI/CD etc, is a junior not expected to know that, but it would be nice to haves? My background is prodominantly javascript, react and node js. I can build full stack applications and deploy them. .Net and C# just feel like a different world compared.
25 replies
CC#
Created by Cydo on 8/27/2024 in #help
✅ Why Red Underline on Views?
it was resharper that was causing the problem, thanks for suggestions.
15 replies
CC#
Created by Cydo on 8/18/2024 in #help
✅ MVC application routing issue.
yes, the tag helpers were the issue all the time, thanks for helping me so much, been at this since 9am lol, and its now 5pm xD
54 replies
CC#
Created by Cydo on 8/18/2024 in #help
✅ MVC application routing issue.
hopefully this fixes my issue on why my add to cart page, saves 0 to my database no matter what number i put in the input as well
54 replies
CC#
Created by Cydo on 8/18/2024 in #help
✅ MVC application routing issue.
No description
54 replies
CC#
Created by Cydo on 8/18/2024 in #help
✅ MVC application routing issue.
I decided to just manually retype all this and save...
@using BulkyWeb
@using Bulky.Models
@using Bulky.Models.ViewModels
@using Bulky.Utility
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@using BulkyWeb
@using Bulky.Models
@using Bulky.Models.ViewModels
@using Bulky.Utility
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
and now it works...
54 replies
CC#
Created by Cydo on 8/18/2024 in #help
✅ MVC application routing issue.
ill keep bashing my head against the issue lol, been trying to solve it since early this morning xD
54 replies
CC#
Created by Cydo on 8/18/2024 in #help
✅ MVC application routing issue.
still nothing
54 replies
CC#
Created by Cydo on 8/18/2024 in #help
✅ MVC application routing issue.
yeah
54 replies