Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/sorvkumr/complete controller methods #25

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sorvkumr
Copy link
Collaborator

Add crud for the Module. Review and added checks in the Designation controller.

@vercel
Copy link

vercel bot commented Jun 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
three-t ✅ Ready (Inspect) Visit Preview Jun 18, 2023 1:38pm

var ret = await _designationService.InsertAsync(value);
if(ret != null) { return TypedResults.Ok(ret); }
return null;
if (value?.Name != "")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use string.IsNullOrEmpty.

var ret = await _designationService.UpdateAsync(value);
if(ret != null) { return TypedResults.Ok(ret); }
return null;
if (value?.Name != "")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use string.IsNullOrEmpty.

{
foreach (var item in items)
{
var projectResult = _projectService.GetAsync(item.ProjectId)?.Result;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await it, insted of Result.

IEnumerable<Module> items = await _repository.GetAsync();
if (items.Any())
{
foreach (var item in items)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this can we use the navigation property, if we have one.


public async Task<ModuleResponse?> GetByIdAsync(Guid? id)
{
var item = await _repository.GetByIDAsync(id);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing 2 queries, can we use a join.

if (ret != null)
{
await _repository.SaveChangesAsync();
var projectVal = _projectService.GetAsync(ret.ProjectId).Result;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await

if (result != null)
{
await _repository.SaveChangesAsync();
var projectVal = _projectService.GetAsync(result.ProjectId).Result;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants