public async Task <IActionResult> PutAddRuleModel(UserProductionModel UserProductionModel) { int id = UserProductionModel.UserProductionId; if (id != UserProductionModel.UserProductionId) { return(BadRequest()); } _context.Entry(UserProductionModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserProductionModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <UserProductionModel> > PostUserProductionModel(UserProductionModel UserProductionModel) { try { UserProductionModel.UserId = User.Claims.First(c => c.Type == "UserID").Value; _context.UserProductionModels.Add(UserProductionModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetUserProductionModel", new { id = UserProductionModel.UserProductionId }, UserProductionModel)); } catch (System.Exception exe) { return(BadRequest(exe.Message)); } }