public ActionResult Edit([Bind(Include = "IdStandard,Name,Description,Version")] Framework.Standard standard, HttpPostedFileBase fileBase) { if (ModelState.IsValid) { db.Entry(standard).State = EntityState.Modified; db.SaveChanges(); if (fileBase != null) { var imgctrl = new ImageController(); imgctrl.SetImage(fileBase, "Standards", standard.IdStandard.ToString()); } return(RedirectToAction("Index")); } return(View(standard)); }
public ActionResult Edit([Bind(Include = "IdFirm,Name,Description,Comment")] Firm firm, HttpPostedFileBase fileBase) { if (ModelState.IsValid) { db.Entry(firm).State = EntityState.Modified; db.SaveChanges(); if (fileBase != null) { var imgctrl = new ImageController(); imgctrl.SetImage(fileBase, "Firms", firm.IdFirm.ToString()); } return(RedirectToAction("Index")); } return(View(firm)); }
public ActionResult Create([Bind(Include = "IdStandard,Name,Description,Version")] Standard standard, HttpPostedFileBase fileBase) { if (ModelState.IsValid) { db.Standards.Add(standard); db.SaveChanges(); if (fileBase != null) { var imgctrl = new ImageController(); imgctrl.SetImage(fileBase, "Standards", standard.IdStandard.ToString()); } ViewBag.ImgTitle = "Upload standard logo"; return(RedirectToAction("Index")); } return(View(standard)); }
public ActionResult Edit([Bind(Include = "IdCustomer,Name,Description,Comment,IdIndustry")] Customer customer, HttpPostedFileBase fileBase) { if (ModelState.IsValid) { var userid = User.Identity.GetUserId(); var firm = db.Users.Find(userid).IdFirm.Value; customer.IdFirm = firm; db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); if (fileBase != null) { var imgctrl = new ImageController(); imgctrl.SetImage(fileBase, "Customers", customer.IdCustomer.ToString()); } return(RedirectToAction("Index")); } ViewBag.IdIndustry = new SelectList(db.Industries, "IdIndustry", "Name", customer.IdIndustry); return(View(customer)); }
public ActionResult Create([Bind(Include = "IdCustomer,Name,Description,Comment,IdIndustry")] Customer customer, HttpPostedFileBase fileBase) { if (ModelState.IsValid) { var userid = User.Identity.GetUserId(); var firm = db.Users.Find(userid).IdFirm.Value; customer.IdFirm = firm; db.Customers.Add(customer); db.SaveChanges(); TempData["Msg"] = "Data has been saved successfully"; if (fileBase != null) { var imgctrl = new ImageController(); imgctrl.SetImage(fileBase, "Customers", customer.IdCustomer.ToString()); } ViewBag.ImgTitle = "Upload customer logo"; return(RedirectToAction("Index")); } ViewBag.IdIndustry = new SelectList(db.Industries, "IdIndustry", "Name", customer.IdIndustry); return(View(customer)); }