public ActionResult DeleteAssignWorkShift(DataSourceLoadOptions loadOptions, string value)
        {
            try
            {
                var deleteAssignWorkShift = new AssignWorkShiftViewModel();
                JsonConvert.PopulateObject(value, deleteAssignWorkShift);

                deleteAssignWorkShift.UpdateBy = UserDetail.UserID;
                DeleteWorkShiftByEmpResult result = MasterService.DeleteAssignWorkShiftByEmp(deleteAssignWorkShift.ToEntity());

                return(Content(JsonConvert.SerializeObject(GetMsgFromDeleteActionResult(result)), ConstantValues.JSON_CONTENT_TYPE));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult UpdateAssignWorkShift(DataSourceLoadOptions loadOptions, string value)
        {
            try
            {
                var updateAssignWorkShift = new AssignWorkShiftViewModel();
                JsonConvert.PopulateObject(value, updateAssignWorkShift);

                ValidateModel(updateAssignWorkShift);
                if (!ModelState.IsValid)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, ModelState.ToString()));
                }

                updateAssignWorkShift.UpdateBy = UserDetail.UserID;
                UpdateWorkShiftByEmpResult result = MasterService.UpdateAssignWorkShiftByEmp(updateAssignWorkShift.ToEntity());

                return(Content(JsonConvert.SerializeObject(GetMsgFromUpdateActionResult(result)), ConstantValues.JSON_CONTENT_TYPE));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public static AssignWorkShiftByEmp ToEntity(this AssignWorkShiftViewModel model)
        {
            var entity = AutoMapper.Mapper.Map <AssignWorkShiftByEmp>(model);

            return(entity);
        }