public void Update(T entity) { if (entity == null) { throw new ArgumentNullException("entity"); } context.Entry(entity).State = EntityState.Modified; //Context.SaveChanges(); }
public async Task <IActionResult> PutLocations(int id, Locations locations) { if (id != locations.Id) { return(BadRequest()); } _context.Entry(locations).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocationsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutEmployee(int id, Employee employee) { if (id != employee.Id) { return(BadRequest()); } _context.Entry(employee).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ID,Date")] Day day) { if (ModelState.IsValid) { db.Entry(day).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(day)); }
public ActionResult Edit([Bind(Include = "ID,Name")] Person person) { if (ModelState.IsValid) { db.Entry(person).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(person)); }
public ActionResult Edit([Bind(Include = "ID,StartTime,EndTime")] Time time) { if (ModelState.IsValid) { db.Entry(time).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(time)); }
public ActionResult Edit([Bind(Include = "ID,DayID,ShiftID")] WorkDay workDay) { if (ModelState.IsValid) { db.Entry(workDay).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DayID = new SelectList(db.Days, "ID", "ID", workDay.DayID); ViewBag.ShiftID = new SelectList(db.Shifts, "ID", "ShiftName", workDay.ShiftID); return(View(workDay)); }
public ActionResult Edit([Bind(Include = "ID,ShiftName")] Shift shift) { var shiftName = shift.ShiftName; if (ModelState.IsValid) { db.Entry(shift).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shift)); }
public IHttpActionResult EditSchedulerEvent(int id, WebAPIEvent webAPIEvent) { var updatedSchedulerEvent = (SchedulerEvent)webAPIEvent; updatedSchedulerEvent.Id = id; db.Entry(updatedSchedulerEvent).State = EntityState.Modified; db.SaveChanges(); return(Ok(new { action = "updated" })); }
public ActionResult Edit([Bind(Include = "ID,ShiftID,PersonID,TimeID,RoleID")] WorkShift workShift) { if (ModelState.IsValid) { db.Entry(workShift).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ShowShift", "WorkShift", new { id = workShift.ShiftID })); } ViewBag.PersonID = new SelectList(db.People, "ID", "Name", workShift.PersonID); ViewBag.RoleID = new SelectList(db.Roles, "ID", "RoleName", workShift.RoleID); ViewBag.ShiftID = new SelectList(db.Shifts, "ID", "ShiftName", workShift.ShiftID); ViewBag.TimeID = new SelectList(db.Times, "ID", "StartTime", workShift.TimeID); return(View(workShift)); }
public IHttpActionResult EditSchedulerEvent(int id, WebAPIRecurringEvent webAPIEvent) { var updatedSchedulerEvent = (SchedulerRecurringEvent)webAPIEvent; updatedSchedulerEvent.Id = id; db.Entry(updatedSchedulerEvent).State = EntityState.Modified; if (!string.IsNullOrEmpty(updatedSchedulerEvent.RecType) && updatedSchedulerEvent.RecType != "none") { //all modified occurrences must be deleted when we update a recurring series //https://docs.dhtmlx.com/scheduler/server_integration.html#savingrecurringevents db.SchedulerRecurringEvents.RemoveRange( db.SchedulerRecurringEvents.Where(e => e.EventPID == id) ); } db.SaveChanges(); return(Ok(new { action = "updated" })); }
public virtual void Add(T entity) { EntityEntry dbEntityEntry = _context.Entry <T>(entity); _context.Set <T>().Add(entity); }
public virtual void Add(T entity) { _context.Entry(entity); _context.Set <T>().Add(entity); }