public async Task <ActionResult> Create([Bind(Include = "ProductId,TypeOfProduct,ProductName,SubTag,COMPOSITION,DOSAGE,Prd_FUNCTION,PRESENTATION,Prod_Pics,Remarks")] M_ProductMaster m_ProductMaster) { if (ModelState.IsValid) { string FullPathWithFileName1 = null; string FolderPathForImage1 = null; string FolderPath = Server.MapPath(Resources.SBSGlobal.ProductPath) + "\\" + m_ProductMaster.ProductName.Trim().Replace(" ", "_"); if (CommonFunction.IsFolderExist(FolderPath)) { if (!string.IsNullOrEmpty(Request.Files["ImagesUpload"].FileName)) { for (int i = 0; i < Request.Files.Count; i++) { FullPathWithFileName1 = FolderPath + "\\" + Request.Files[i].FileName; Request.Files[i].SaveAs(FullPathWithFileName1); } } } m_ProductMaster.CreatedBy = Session["CurrentUser"].ToString(); m_ProductMaster.CreatedDate = DateTime.Now; m_ProductMaster.ModifiedBy = Session["CurrentUser"].ToString(); m_ProductMaster.ModifiedDate = DateTime.Now; m_ProductMaster.Active = true; db.M_ProductMaster.Add(m_ProductMaster); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.TypeOfProduct = new SelectList(db.M_MasterTable, "MasterId", "MasterValue", m_ProductMaster.TypeOfProduct); return(View(m_ProductMaster)); }
public async Task <ActionResult> DeleteConfirmed(int id) { M_ProductMaster m_ProductMaster = await db.M_ProductMaster.FindAsync(id); db.M_ProductMaster.Remove(m_ProductMaster); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "ProductId,TypeOfProduct,ProductName,SubTag,COMPOSITION,DOSAGE,Prd_FUNCTION,PRESENTATION,Prod_Pics,Remarks,CreatedBy,CreatedDate,ModifiedBy,ModifiedDate,Active")] M_ProductMaster m_ProductMaster) { if (ModelState.IsValid) { db.Entry(m_ProductMaster).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.TypeOfProduct = new SelectList(db.M_MasterTable, "MasterId", "MasterValue", m_ProductMaster.TypeOfProduct); return(View(m_ProductMaster)); }
// GET: M_ProductMaster/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } M_ProductMaster m_ProductMaster = await db.M_ProductMaster.FindAsync(id); if (m_ProductMaster == null) { return(HttpNotFound()); } return(View(m_ProductMaster)); }
public async Task <ActionResult> Create([Bind(Include = "ProductId,ProductName,ProductSubTitle,ProdDescription,KeyFeatures,Composition,ProdApplication,ProdPresentation,ImgPath1,ImgPath2,ImgPath3")] M_ProductMaster m_ProductMaster, FormCollection frm) { if (ModelState.IsValid) { if (!string.IsNullOrEmpty(Request.Files["ImgPath1"].FileName)) { string FolderPath = Server.MapPath(Resources.PoshakBioSciencesWebResources.TextNewImagesPath); // + "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek; string FullPathWithFileName = FolderPath + "\\" + Request.Files["ImgPath1"].FileName; string FolderPathForImage = Request.Files["ImgPath1"].FileName; //"\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["StdProfilePicPath"].FileName; if (CommonFunction.IsFolderExist(FolderPath)) { Request.Files["ImgPath1"].SaveAs(FullPathWithFileName); m_ProductMaster.ImgPath1 = FolderPathForImage; } } if (!string.IsNullOrEmpty(Request.Files["ImgPath2"].FileName)) { string FolderPath = Server.MapPath(Resources.PoshakBioSciencesWebResources.TextNewImagesPath); // + "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek; string FullPathWithFileName = FolderPath + "\\" + Request.Files["ImgPath2"].FileName; string FolderPathForImage = Request.Files["ImgPath2"].FileName; //"\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["StdProfilePicPath"].FileName; if (CommonFunction.IsFolderExist(FolderPath)) { Request.Files["ImgPath2"].SaveAs(FullPathWithFileName); m_ProductMaster.ImgPath2 = FolderPathForImage; } } if (!string.IsNullOrEmpty(Request.Files["ImgPath3"].FileName)) { string FolderPath = Server.MapPath(Resources.PoshakBioSciencesWebResources.TextNewImagesPath); // + "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek; string FullPathWithFileName = FolderPath + "\\" + Request.Files["ImgPath3"].FileName; string FolderPathForImage = Request.Files["ImgPath3"].FileName; //"\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["StdProfilePicPath"].FileName; if (CommonFunction.IsFolderExist(FolderPath)) { Request.Files["ImgPath3"].SaveAs(FullPathWithFileName); m_ProductMaster.ImgPath3 = FolderPathForImage; } } m_ProductMaster.CreatedBy = Session["PrCode"].ToString(); m_ProductMaster.CreatedDate = DateTime.Now; m_ProductMaster.ModifiedBy = Session["PrCode"].ToString(); m_ProductMaster.ModifiedDate = DateTime.Now; m_ProductMaster.Active = true; db.M_ProductMaster.Add(m_ProductMaster); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(m_ProductMaster)); }
public async Task <ActionResult> Edit([Bind(Include = "ProductID,CategoryID,ProductCode,ProductName,ProdDesc,MinQty,TotQty,Rate,SGST,CGST,IGST,CreatedBy,CreatedDate,Active")] M_ProductMaster m_ProductMaster) { if (ModelState.IsValid) { m_ProductMaster.ModifiedBY = Session["CurrentUser"].ToString(); m_ProductMaster.ModifiedDate = DateTime.Now; db.Entry(m_ProductMaster).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.M_CategoryMaster, "CategoryID", "CategoryName", m_ProductMaster.CategoryID); return(View(m_ProductMaster)); }
// GET: M_ProductMaster/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } M_ProductMaster m_ProductMaster = await db.M_ProductMaster.FindAsync(id); if (m_ProductMaster == null) { return(HttpNotFound()); } ViewBag.TypeOfProduct = new SelectList(db.M_MasterTable, "MasterId", "MasterValue", m_ProductMaster.TypeOfProduct); return(View(m_ProductMaster)); }
// GET: ProductMaster/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } M_ProductMaster m_ProductMaster = await db.M_ProductMaster.FindAsync(id); if (m_ProductMaster == null) { return(HttpNotFound()); } ViewBag.CategoryID = new SelectList(db.M_CategoryMaster, "CategoryID", "CategoryName", m_ProductMaster.CategoryID); return(View(m_ProductMaster)); }