public ActionResult <NoticeDeleteModel> DeleteNotice(NoticeDeleteModel notice) { NoticeDeleteModel deleteNotice = new NoticeDeleteModel(); try { deleteNotice = _noticeService.DeleteNotice(notice); } catch (Exception es) { deleteNotice._failure = true; deleteNotice._message = es.Message; } return(deleteNotice); }
public NoticeDeleteModel DeleteNotice(NoticeDeleteModel notice) { NoticeDeleteModel noticdeleteModel = new NoticeDeleteModel(); if (TokenManager.CheckToken(notice._tenantName + notice._userName, notice._token)) { noticdeleteModel = this.noticeRepository.DeleteNotice(notice); return(noticdeleteModel); } else { noticdeleteModel._failure = true; noticdeleteModel._message = TOKENINVALID; return(noticdeleteModel); } }
/// <summary> /// Delete Notice /// </summary> /// <param name="notice"></param> /// <returns></returns> public NoticeDeleteModel DeleteNotice(NoticeDeleteModel notice) { try { var noticeRepository = this.context?.Notice.Where(x => x.NoticeId == notice.NoticeId).ToList().OrderBy(x => x.NoticeId).LastOrDefault(); noticeRepository.Isactive = false; this.context?.SaveChanges(); notice._failure = false; return(notice); } catch (Exception ex) { throw ex; } }
/// <summary> /// Delete Notice /// </summary> /// <param name="notice"></param> /// <returns></returns> public NoticeDeleteModel DeleteNotice(NoticeDeleteModel notice) { try { var noticeRepository = this.context?.Notice.FirstOrDefault(x => x.TenantId == notice.TenantId && x.SchoolId == notice.SchoolId && x.NoticeId == notice.NoticeId); noticeRepository.Isactive = false; this.context?.SaveChanges(); notice._failure = false; notice._message = "Notice Deleted Successfuly"; return(notice); } catch (Exception ex) { throw ex; } }