Example #1
0
        public SchedulingTableModel CreateOrUpdate(SchedulingTableModel model)
        {
            Logger.Debug($"{model}");

            if (model == null)
            {
                throw new System.ArgumentNullException("model");
            }

            SchedulingTable schedule = null;

            if (model.Id == null || model.Id == System.Guid.Empty)
            {
                schedule = this.UnitOfWork.SchedulingTableRepository.CreateSchedule(model.SemesterId, model.Name, model.ShortName, model.HighlightColor, model.LogoUrl, model.IsActive);
            }
            else
            {
                schedule = this.UnitOfWork.SchedulingTableRepository.UpdateSchedule(model.Id, model.SemesterId, model.Name, model.ShortName, model.HighlightColor, model.LogoUrl, model.IsActive);
            }

            this.UnitOfWork.SaveChanges();

            SchedulingTableModel scheduleModel = Mapper.Map <Models.SchedulingTable, Models.SchedulingTableModel>(schedule);

            return(scheduleModel);
        }
Example #2
0
        public SchedulingTableModel GetSchedule(Guid id)
        {
            Logger.Debug($"{id}");

            if (id == null || id == System.Guid.Empty)
            {
                throw new System.ArgumentNullException("id");
            }

            SchedulingTable schedule = this.UnitOfWork.SchedulingTableRepository.GetById(id);

            SchedulingTableModel scheduleModel = Mapper.Map <Models.SchedulingTable, Models.SchedulingTableModel>(schedule);

            return(scheduleModel);
        }