示例#1
0
        public EventMD AddEvent(EventMD mod)
        {
            try
            {
                var entity = mod.Translate();
                _EventRepo.Insert(entity);
                _EventRepo.CommitAllChanges();
                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_ADD, "Event"));
                mod.Id = entity.Id;
            }
            catch (Exception ex)
            {
                mod.HasErrors = true;
                mod.AddErrorMessage(string.Format(AppConstants.CRUD_ADD_ERROR, "Event"));
            }

            return(mod);
        }
示例#2
0
        public EventMD DeleteEvent(long id)
        {
            var mod = new EventMD();

            try
            {
                var Event = _EventRepo.Fetch(x => x.IsActive);
                Event.IsActive = false;
                _EventRepo.Update(Event);
                _EventRepo.CommitAllChanges();

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