public ActionResult Delete(int id) { SBH_TM_SLIDESHOW slideshowView = new SBH_TM_SLIDESHOW(); SBH_TM_SLIDESHOW slideshowRes = new SBH_TM_SLIDESHOW(); slideshowView.ID = id; slideshowRes = repo.Retrieve(id); return(PartialView(slideshowRes)); }
public ActionResult Edit(int id) { SBH_TM_SLIDESHOW slideshowView = new SBH_TM_SLIDESHOW(); SBH_TM_SLIDESHOW slideshowRes = new SBH_TM_SLIDESHOW(); ViewBag.GetClassActiveList = Dropdown.GetClassActiveList(); slideshowView.ID = id; slideshowRes = repo.Retrieve(id); return(PartialView(slideshowRes)); }
public ResultStatus Add(SBH_TM_SLIDESHOW slideshow) { try { _ctx.SBH_TM_SLIDESHOW.Add(slideshow); _ctx.SaveChanges(); rs.SetSuccessStatus(); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); } return(rs); }
public ActionResult ActionEdit(SBH_TM_SLIDESHOW slideshowView, HttpPostedFileBase postedFile) { try { string encodedString = Server.HtmlEncode(slideshowView.CONTENT_DESCRIPTION); slideshowView.CONTENT_DESCRIPTION = encodedString; string physicalPath = ""; if (postedFile != null) { string ImageName = System.IO.Path.GetFileName(postedFile.FileName); //file2 to store path and url physicalPath = Server.MapPath("~" + Common.GetPathFolderImg() + ImageName); slideshowView.PHOTO_PATH = Common.GetPathFolderImg() + ImageName; } slideshowView.LAST_MODIFIED_BY = Session["UserId"].ToString(); slideshowView.LAST_MODIFIED_TIME = DateTime.Now; rs = repo.Edit(slideshowView); if (rs.IsSuccess) { if (physicalPath != "") { postedFile.SaveAs(physicalPath); } rs.SetSuccessStatus("Data has been edited successfully"); TempData["msgSuccess"] = rs.MessageText; } else { rs.SetErrorStatus("Data failed to edited"); TempData["msgError"] = rs.MessageText; } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); rs.SetErrorStatus("Data failed to edited"); TempData["msgError"] = rs.MessageText; } return(RedirectToAction("Index")); }
public ResultStatus Delete(int id, string modifiedBy, DateTime modifiedTime) { try { SBH_TM_SLIDESHOW slideshow = _ctx.SBH_TM_SLIDESHOW.Find(id); slideshow.LAST_MODIFIED_TIME = modifiedTime; slideshow.LAST_MODIFIED_BY = modifiedBy; slideshow.ROW_STATUS = eStat.fg.NotActive; _ctx.Entry(slideshow).State = EntityState.Modified; _ctx.SaveChanges(); rs.SetSuccessStatus(); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); } return(rs); }
public ResultStatus Edit(SBH_TM_SLIDESHOW slideshow) { try { SBH_TM_SLIDESHOW slideshowNew = _ctx.SBH_TM_SLIDESHOW.Find(slideshow.ID); slideshowNew.TITTLE = slideshow.TITTLE; slideshowNew.CONTENT_DESCRIPTION = slideshow.CONTENT_DESCRIPTION; slideshowNew.CLASS = slideshow.CLASS; slideshowNew.PHOTO_PATH = slideshow.PHOTO_PATH; slideshowNew.URL = slideshow.URL; slideshowNew.LAST_MODIFIED_TIME = slideshow.LAST_MODIFIED_TIME; slideshowNew.LAST_MODIFIED_BY = slideshow.LAST_MODIFIED_BY; _ctx.Entry(slideshowNew).State = System.Data.Entity.EntityState.Modified; _ctx.SaveChanges(); rs.SetSuccessStatus(); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); } return(rs); }