Example #1
0
        public ScheduleMD ModifySchedule(ScheduleMD mod)
        {
            var entity = mod.Translate();

            try
            {
                _ScheduleRepo.Update(entity);
                _ScheduleRepo.CommitAllChanges();
                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_UPDATE, "Schedule"));
            }
            catch (Exception)
            {
                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_UPDATE_ERROR, "Schedule"));
            }

            return(mod);
        }
Example #2
0
        public ScheduleMD AddSchedule(ScheduleMD mod)
        {
            try
            {
                var entity = mod.Translate();
                _ScheduleRepo.Insert(entity);
                _ScheduleRepo.CommitAllChanges();
                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_ADD, "Schedule"));
                mod.Id = entity.Id;
            }
            catch (Exception ex)
            {
                mod.AddErrorMessage(string.Format(AppConstants.CRUD_ADD_ERROR, "Schedule"));
            }

            return(mod);
        }
Example #3
0
        public ScheduleMD DeleteSchedule(long id)
        {
            var mod = new ScheduleMD();

            try
            {
                var Schedule = _ScheduleRepo.Fetch(x => x.IsActive);
                Schedule.IsActive = false;
                _ScheduleRepo.Update(Schedule);
                _ScheduleRepo.CommitAllChanges();

                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_DELETE, "Schedule"));
            }
            catch (Exception ex)
            {
                mod.AddErrorMessage(string.Format(AppConstants.CRUD_DELETE_ERROR, "Schedule"));
            }
            return(mod);
        }