public string SaveCalendar(List <HospitalCalendarViewModel> calendarData) { var returnObject = new AJAXReturnObject(); try { using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork()) { HospitalCalendar entity = new HospitalCalendar(); foreach (var item in calendarData) { if (item.Id != null) { entity = _hospitalCalendarService.GetById(new Guid(item.Id.ToString())); entity.Enabled = item.Enabled; entity.UpdatedBy = WorkContext.CurrentMembershipUser.Username; } else { entity = new HospitalCalendar(); entity.Enabled = item.Enabled; entity.CreatedBy = entity.UpdatedBy = WorkContext.CurrentMembershipUser.Username; entity.StartDate = item.StartDate; entity.EndDate = item.EndDate; _hospitalCalendarService.AddCalendar(entity); } unitOfWork.SaveChanges(); } unitOfWork.Commit(); } } catch (Exception ex) { returnObject.Status = AJAXReturnResult.Failed; returnObject.Message = ex.Message; } return(JsonHelper.SerializeToJson(returnObject)); }
public void DeleteCalendar(HospitalCalendar item) { throw new NotImplementedException(); }
public void DeleteCalendar(HospitalCalendar item) { _hospitalCalendarRepository.DeleteCalendar(item); }
public void AddCalendar(HospitalCalendar item) { _context.HospitoalCalendar.Add(item); }
public void AddCalendar(HospitalCalendar item) { _hospitalCalendarRepository.AddCalendar(item); }