コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public void Update(ResourceShifts employeeShift)
 {
     _currentDbContext.ResourceShifts.Attach(employeeShift);
     _currentDbContext.Entry(employeeShift).State = EntityState.Modified;
     _currentDbContext.SaveChanges();
 }
コード例 #4
0
 public int Insert(ResourceShifts employeeShift)
 {
     _currentDbContext.Entry(employeeShift).State = EntityState.Added;
     _currentDbContext.SaveChanges();
     return(employeeShift.Id);
 }