public ActionResult DeleteNew(int idNews) { try { NewsDAL objCtrl = new NewsDAL(); var result = objCtrl.GetItemByID("Id", idNews); if (isChief) { if (result.Status != 3) { if (result.CreatedBy == SysBaseInfor.GetCurrentUserId()) { objCtrl.DeleteItemByValues("Id", idNews); return(Content("Success")); } else { if (result.Status != 0 || result.Status != 4) { objCtrl.DeleteItemByValues("Id", idNews); return(Content("Success")); } } } } else { if (result.CreatedBy == SysBaseInfor.GetCurrentUserId() && (result.Status == 0 || result.Status == 4)) { objCtrl.DeleteItemByValues("Id", idNews); return(Content("Success")); } } return(Content("Không thể xóa")); } catch (Exception ex) { return(Content(ex.Message)); } }
public JsonResult GetDataNews(List <int> lstNewsGetData) { try { NewsDAL newCtrl = new NewsDAL(); foreach (int newsId in lstNewsGetData) { News news = newCtrl.GetItemByID("Id", newsId); var tmpContent = UploadAllImageInNewsToServer(news.FullContent, news.Id); if (!string.IsNullOrEmpty(tmpContent)) { news.FullContent = tmpContent; newCtrl.UpdateItem(news); } } return(Json(new { Msg = "Success" })); } catch (Exception ex) { return(Json(new { Msg = "Fail" })); } }