Example #1
0
        public bool DelSystemParameter(int id, out string error)
        {
            error = string.Empty;
            bool result = false;

            var query = SystemParameterRepository.GetQueryable().FirstOrDefault(a => a.Id == id);

            if (query != null)
            {
                try
                {
                    SystemParameterRepository.Delete(query);
                    SystemParameterRepository.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    error = "原因:" + ex.Message;
                }
            }
            else
            {
                error = "原因:未找到当前需要删除的数据!";
            }

            return(result);
        }
        public void Delete(int id)
        {
            var entity = _repository.GetEntity(id);

            _repository.Delete(entity);
        }