public async Task <ActionResult> Create([Bind(Include = "BannerID,BannerHeader,BannerText,BannerImagesPath,Description,BannerSequence")] M_BannerMaster m_BannerMaster) { string FullPathWithFileName1 = null; string FolderPathForImage1 = null; string FolderPath = Server.MapPath(Resources.RSAResourcesAdmin.BannerImagesPath) + "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek; if (!string.IsNullOrEmpty(Request.Files["BannerImagesPath"].FileName)) { FullPathWithFileName1 = FolderPath + "\\" + Request.Files["BannerImagesPath"].FileName; FolderPathForImage1 = "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["BannerImagesPath"].FileName; } if (RSACommonFunctions.IsFolderExist(FolderPath)) { if (!string.IsNullOrEmpty(Request.Files["BannerImagesPath"].FileName)) { Request.Files["BannerImagesPath"].SaveAs(FullPathWithFileName1); m_BannerMaster.BannerImagesPath = FolderPathForImage1; } } if (ModelState.IsValid) { m_BannerMaster.CreatedBy = Session["LoginUser"].ToString(); m_BannerMaster.CreatedDate = DateTime.Now; m_BannerMaster.ModifiedBy = Session["LoginUser"].ToString(); m_BannerMaster.ModifiedDate = DateTime.Now; m_BannerMaster.Active = true; db.M_BannerMaster.Add(m_BannerMaster); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(m_BannerMaster)); }
public async Task <ActionResult> DeleteConfirmed(int id) { M_BannerMaster m_BannerMaster = await db.M_BannerMaster.FindAsync(id); db.M_BannerMaster.Remove(m_BannerMaster); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "BannerID,BannerHeader,BannerText,BannerImagesPath,Description,BannerSequence,CreatedBy,CreatedDate,ModifiedBy,ModifiedDate,Active")] M_BannerMaster m_BannerMaster) { if (ModelState.IsValid) { db.Entry(m_BannerMaster).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(m_BannerMaster)); }
// GET: BannerMaster/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } M_BannerMaster m_BannerMaster = await db.M_BannerMaster.FindAsync(id); if (m_BannerMaster == null) { return(HttpNotFound()); } return(View(m_BannerMaster)); }