public async Task <IActionResult> PutPlants(int id, Plants plants) { //Update a plant if (id != plants.PlantID) { return(BadRequest()); } _context.Entry(plants).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlantsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutUserType(int id, UserType userType) { //Update a user type if (id != userType.UserTypeID) { return(BadRequest()); } _context.Entry(userType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutApprovedType(int id, ApprovedType approvedType) { //Update approved type based on the id and object provided if (id != approvedType.ApprovedTypeID) { return(BadRequest()); } _context.Entry(approvedType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ApprovedTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutComments(int id, Comments comments) { //Update a comment based on its id if (id != comments.CommentID) { return(BadRequest()); } _context.Entry(comments).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutArticle(int id, Article article) { //Update an article if (id != article.ArticleID) { return(BadRequest()); } _context.Entry(article).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArticleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }