public JsonResult CreateResourceShift(ResourceShifts resourceShifts) { if (resourceShifts.Id > 0) { resourceShifts.TenantId = CurrentTenantId; resourceShifts.DateUpdated = DateTime.UtcNow; resourceShifts.Date = resourceShifts.TimeStamp.Date; resourceShifts.UpdatedBy = CurrentUserId; var weeknumbers = GetWeekNumber(resourceShifts.TimeStamp); resourceShifts.WeekNumber = weeknumbers; _employeeShiftsServices.Update(resourceShifts); return(Json(true, JsonRequestBehavior.AllowGet)); } resourceShifts.TenantId = CurrentTenantId; resourceShifts.DateCreated = DateTime.UtcNow; var weeknumber = GetWeekNumber(resourceShifts.TimeStamp); resourceShifts.WeekNumber = weeknumber; resourceShifts.Date = resourceShifts.TimeStamp.Date; resourceShifts.CreatedBy = CurrentUserId; _employeeShiftsServices.Insert(resourceShifts); return(Json(true, JsonRequestBehavior.AllowGet)); }
public JsonResult deleteResourceShift(int?id) { ResourceShifts resourceShifts = _employeeShiftsServices.GetResourceShifts(id); resourceShifts.TenantId = CurrentTenantId; resourceShifts.DateUpdated = DateTime.UtcNow; resourceShifts.UpdatedBy = CurrentUserId; resourceShifts.IsDeleted = true; _employeeShiftsServices.Update(resourceShifts); return(Json(true, JsonRequestBehavior.AllowGet)); }
public void Update(ResourceShifts employeeShift) { _currentDbContext.ResourceShifts.Attach(employeeShift); _currentDbContext.Entry(employeeShift).State = EntityState.Modified; _currentDbContext.SaveChanges(); }
public int Insert(ResourceShifts employeeShift) { _currentDbContext.Entry(employeeShift).State = EntityState.Added; _currentDbContext.SaveChanges(); return(employeeShift.Id); }