public async Task <IActionResult> PutProject([FromRoute] Guid id, [FromBody] Project project) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != project.Id) { return(BadRequest()); } _context.Entry(project).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,Name,RegisteredDate")] Project project) { if (ModelState.IsValid) { project.Id = Guid.NewGuid(); _context.Add(project); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(project)); }