/// <summary> /// 根据ID删除字典 /// </summary> /// <param name="dictId"></param> /// <returns></returns> public MsgEntity DelDict(string dictId) { MsgEntity me = new MsgEntity(); if (string.IsNullOrEmpty(dictId)) { me.MsgCode = MsgEntity.MsgCodeEnum.Failure; me.MsgDes = "字典ID不存在"; return(me); } try { dao.Delete <T_Sys_Dict>(dictId); me.MsgCode = MsgEntity.MsgCodeEnum.Success; me.MsgDes = "字典删除成功"; } catch (Exception ex) { me.MsgCode = MsgEntity.MsgCodeEnum.Failure; me.MsgDes = ex.Message; } return(me); }
/// <summary> /// 删除 /// </summary> /// <param name="category"></param> /// <returns></returns> public MsgEntity Delete(string ID) { MsgEntity me = new MsgEntity(); try { dao.Delete <T_EC_KWCategory>(ID); me.MsgCode = MsgEntity.MsgCodeEnum.Success; me.MsgDes = "删除成功"; } catch (Exception ex) { me.MsgCode = MsgEntity.MsgCodeEnum.Failure; me.MsgDes = ex.Message; } return(me); }
public ApiResponse Delete(int id) { ApiResponse resp = new ApiResponse(); if (id <= 0) { resp.Success = false; resp.ErrorList = new List <string>(); resp.ErrorList.Add("Nivel usuario nao informado"); return(resp); } DAOBase <TipoUsuario> dao = new DAOBase <TipoUsuario>(); TipoUsuario n = dao.GetById(id); if (n == null) { resp.Success = false; resp.ErrorList = new List <string>(); resp.ErrorList.Add("Nivel de usuario: " + id + " informado inexistente"); return(resp); } try { dao.Delete(n); resp.Success = true; return(resp); } catch (Exception e) { resp.Success = false; resp.ErrorList = new List <string>(); resp.ErrorList.Add(e.Message); return(resp); } }
public ApiResponse Delete(int id) { ApiResponse resp = new ApiResponse(); if (id <= 0) { resp.Success = false; resp.ErrorList = new List <string>(); resp.ErrorList.Add("Alcada nao informada"); return(resp); } DAOBase <Alcada> daoAlacada = new DAOBase <Alcada>(); Alcada a = daoAlacada.GetById(id); if (a == null) { resp.Success = false; resp.ErrorList = new List <string>(); resp.ErrorList.Add("Alcada: " + id + " informada inexistente"); return(resp); } try { daoAlacada.Delete(a); resp.Success = true; return(resp); } catch (Exception e) { resp.Success = false; resp.ErrorList = new List <string>(); resp.ErrorList.Add(e.Message); return(resp); } }