public ResponseInfo AddTruyen(NewComic data) { ResponseInfo response = new ResponseInfo(); try { var kt = Convert.ToInt64(new GetPermission().GetQuyen("STORY_CRE")) & Convert.ToInt64(Common.Common.GetTongQuyen()); if (kt != 0) { response = new QuanLyTruyenModel().AddTruyen(data); } else { var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.BanKhongDuQuyen); response.TypeMsgError = errorMsg.Type; response.MsgError = errorMsg.Msg; } } catch (Exception e) { response.Code = (int)ConstantsEnum.CodeResponse.ServerError; var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.ServerError); response.TypeMsgError = errorMsg.Type; response.MsgError = errorMsg.Msg; response.ThongTinBoSung1 = e.Message; } return(response); }
public ResponseInfo DeleteTruyen(int id) { ResponseInfo response = new ResponseInfo(); try { bool deleted = new QuanLyTruyenModel().DeleteTruyen(id); var kt = Convert.ToInt64(new GetPermission().GetQuyen("STORY_DEL")) & Convert.ToInt64(Common.Common.GetTongQuyen()); if (kt != 0) { if (deleted) { response.IsSuccess = true; var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.XoaDuLieuThanhCong); response.TypeMsgError = errorMsg.Type; response.MsgError = errorMsg.Msg; } else { var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.XoaDuLieuThatBai); response.TypeMsgError = errorMsg.Type; response.MsgError = errorMsg.Msg; } } else { var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.BanKhongDuQuyen); response.TypeMsgError = errorMsg.Type; response.MsgError = errorMsg.Msg; } } catch (Exception e) { response.Code = (int)ConstantsEnum.CodeResponse.ServerError; var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.ServerError); response.TypeMsgError = errorMsg.Type; response.MsgError = errorMsg.Msg; response.ThongTinBoSung1 = e.Message; } return(response); }