public async Task <JsonResult> Update(BreakTypeViewModel vm) { try { var model = BreakTypeUtility.VMToM(vm); model.CreatedAt = TimeUtility.GetTimeZoneByName(CurrentUser.TimeZone); model.CreatedBy = CurrentUser.ID; model.isArchived = false; _breakTypeService.Update(model); return(Json(new { success = true, data = BreakTypeUtility.MToVM(model) })); } catch { return(Json(new { success = false })); } }
public async Task <JsonResult> Insert(BreakTypeViewModel vm) { try { vm.ID = CharacterGenerator.NewGUID(); vm.CompanyID = CurrentUser.CompanyID; var model = BreakTypeUtility.VMToM(vm); model.isArchived = false; _breakTypeService.Insert(model); return(Json(new { success = true, data = BreakTypeUtility.MToVM(model) })); } catch { return(Json(new { success = false })); } }