public ActionResult BradfordFactor() { BradfordFactorViewModel model = new BradfordFactorViewModel(); var bradfordFactor = _holidayNAbsenceMethod.getBradfordFactor(); if (bradfordFactor != null) { model.Id = bradfordFactor.Id; model.LowerValue1 = bradfordFactor.LowerValue1; model.UpperValue1 = bradfordFactor.UpperValue1; model.Alert1 = bradfordFactor.Alert1; model.LowerValue2 = bradfordFactor.LowerValue2; model.UpperValue2 = bradfordFactor.UpperValue2; model.Alert2 = bradfordFactor.Alert2; model.LowerValue3 = bradfordFactor.LowerValue3; model.UpperValue3 = bradfordFactor.UpperValue3; model.Alert3 = bradfordFactor.Alert3; model.LowerValue4 = bradfordFactor.LowerValue4; model.UpperValue4 = bradfordFactor.UpperValue4; model.Alert4 = bradfordFactor.Alert4; } else { model.Id = 0; } return(PartialView("_partialBradfordFactor", model)); }
public void SaveBradfordFactor(BradfordFactorViewModel model) { if (model.Id > 0) { BradfordFactor_HolidaySettings bradfordFactor = _db.BradfordFactor_HolidaySettings.FirstOrDefault(); bradfordFactor.LowerValue1 = model.LowerValue1; bradfordFactor.UpperValue1 = model.UpperValue1; bradfordFactor.Alert1 = model.Alert1; bradfordFactor.LowerValue2 = model.LowerValue2; bradfordFactor.UpperValue2 = model.UpperValue2; bradfordFactor.Alert2 = model.Alert2; bradfordFactor.LowerValue3 = model.LowerValue3; bradfordFactor.UpperValue3 = model.UpperValue3; bradfordFactor.Alert3 = model.Alert3; bradfordFactor.LowerValue4 = model.LowerValue4; bradfordFactor.UpperValue4 = model.UpperValue4; bradfordFactor.Alert4 = model.Alert4; _db.SaveChanges(); } else { BradfordFactor_HolidaySettings bradfordFactor = new BradfordFactor_HolidaySettings(); bradfordFactor.LowerValue1 = model.LowerValue1; bradfordFactor.UpperValue1 = model.UpperValue1; bradfordFactor.Alert1 = model.Alert1; bradfordFactor.LowerValue2 = model.LowerValue2; bradfordFactor.UpperValue2 = model.UpperValue2; bradfordFactor.Alert2 = model.Alert2; bradfordFactor.LowerValue3 = model.LowerValue3; bradfordFactor.UpperValue3 = model.UpperValue3; bradfordFactor.Alert3 = model.Alert3; bradfordFactor.LowerValue4 = model.LowerValue4; bradfordFactor.UpperValue4 = model.UpperValue4; bradfordFactor.Alert4 = model.Alert4; _db.BradfordFactor_HolidaySettings.Add(bradfordFactor); _db.SaveChanges(); } }
public ActionResult SaveBradfordFactor(BradfordFactorViewModel model) { _holidayNAbsenceMethod.SaveBradfordFactor(model); return(Json("sucess", JsonRequestBehavior.AllowGet)); }