public Project PostProject([FromBody] Todoapp.Models.Project project) { project.ApplicationUser = (from u in _context.Users.Include(u => u.Projects) where u.Id == User.FindFirst(ClaimTypes.NameIdentifier).Value select u).ToArray()[0]; _context.Projects.Add(project); _context.SaveChanges(); return(project); }
public Project PutProject(int id, [FromBody] Todoapp.Models.Project project) { _context.Entry(project).State = EntityState.Modified; _context.SaveChanges(); return(project); }