public ActionResult Edit([Bind(Include = "Id,SalesManId,FullName,BranchId,Email,AltEmail,Phone1,Phone2")] SalesMan salesman) { if (ModelState.IsValid) { //salesman.BranchId = Convert.ToInt32(Session["BranchId"].ToString()); db.Entry(salesman).State = EntityState.Modified; try { db.SaveChanges(); //int BranchId = Convert.ToInt32(Session["BranchId"].ToString()); String Operation = "Sales Man Updated Sucessfully"; db.ActivityLog.Add(new ActivityLog { //BranchId = BranchId, Operation = Operation, CreatedBy = Session["userEmail"].ToString(), CreatedDate = DateTime.Now }); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } } return(View(salesman)); }
public ActionResult Edit([Bind(Include = "Id,SalesManId,Area,Comment,CreatedBy,EditedBy,ModifiedBy")] AreaRegister arearegister) { if (ModelState.IsValid) { db.Entry(arearegister).State = EntityState.Modified; try { db.SaveChanges(); String Operation = "Area register sucessfully"; db.ActivityLog.Add(new ActivityLog { Operation = Operation, CreatedBy = Session["userEmail"].ToString(), CreatedDate = DateTime.Now }); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } } ViewBag.SalesManId = new SelectList(db.SalesMan, "Id", "FullName", arearegister.SalesManId); return(View(arearegister)); }
public ActionResult Edit(Customer customer) { ViewBag.OfficerId = new SelectList(db.Officers.Where(m => m.Status && m.OfficerType == "निशुल्क प्रदान गर्ने"), "Id", "Name", customer.OfficerId != null ? customer.OfficerId : null); if (ModelState.IsValid) { customer.RegisterDate = DateTime.Now; customer.RegisteredBy = Session["userEmail"].ToString(); db.Entry(customer).State = EntityState.Modified; try { db.SaveChanges(); String Operation = "Customer Updated Sucessfully"; db.ActivityLog.Add(new ActivityLog { BranchId = customer.BranchId, Operation = Operation, CreatedBy = Session["userEmail"].ToString(), CreatedDate = DateTime.Now }); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } } return(View(customer)); }
public ActionResult Edit([Bind(Include = "Id,NewspaperName,CreatedBy,UpdatedBy,CreatedDate,UpdatedDate")] Newspaper.Models.Newspaper newspaper) { if (ModelState.IsValid) { db.Entry(newspaper).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(newspaper)); }
public ActionResult Edit([Bind(Include = "Id,RouteId,RouteName")] Route route) { if (ModelState.IsValid) { db.Entry(route).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(route)); }
public ActionResult Edit([Bind(Include = "Id,PaperDispatchDate,EndedDate,NepaliDate,CreatedBy,UpdatedBy,CreatedDate,UpdatedDate,status,CustomerId,NewspaperId")] ServiceAssign serviceAssign) { if (ModelState.IsValid) { db.Entry(serviceAssign).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(serviceAssign)); }
public ActionResult Edit([Bind(Include = "BranchId,BranchName,BranchAddress,BrachPhone")] Branch branch) { if (ModelState.IsValid) { db.Entry(branch).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(branch)); }
public ActionResult Edit([Bind(Include = "Id,GroupId,GroupName")] PrakashanGroup prakashanGroup) { if (ModelState.IsValid) { db.Entry(prakashanGroup).State = EntityState.Modified; db.SaveChanges(); TempData["message"] = "Prakahan Group Edited successfully"; return(RedirectToAction("Index")); } return(View(prakashanGroup)); }
public ActionResult Edit([Bind(Include = "Id,NepYear,EngYear,Status,CreatedBy,EditedBy,CreatedDate,EditedDate")] FiscalYear fiscalYear) { if (ModelState.IsValid) { fiscalYear.CreatedDate = DateTime.Now; fiscalYear.EditedBy = Session["userEmail"].ToString(); fiscalYear.EditedDate = DateTime.Now; db.Entry(fiscalYear).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fiscalYear)); }
public ActionResult Edit([Bind(Include = "Id,AgentName,Pan,GP_Quantity,RN_Quantity,MUNA_Quantity,Madhu_Quantity,Yuwa_Quantity,Address,Time,RouteName,Transport,State,District,Phone,Email,URL,RouteId")] GroupName groupName) { if (ModelState.IsValid) { groupName.Route = db.Routes.Find(groupName.RouteId); db.Entry(groupName).State = EntityState.Modified; db.SaveChanges(); TempData["message"] = "Agent Edited successfully"; return(RedirectToAction("Index")); } ViewBag.RouteId = new SelectList(db.Routes, "Id", "RouteName", groupName.RouteName); return(View(groupName)); }
public ActionResult Edit([Bind(Include = "Id,ServiceCode,NewsPaperName,TimeBase,CreatedBy,EditedBy,EditedDate,Images")] Service service, HttpPostedFileBase ImageFile) { if (ModelState.IsValid) { db.Entry(service).State = EntityState.Modified; HttpFileCollectionBase image = Request.Files; if (ImageFile != null) { string fileName1 = image[0].FileName; ///string filename = Path.GetFileNameWithoutExtension(admin.ImageFile.FileName); //string extension = Path.GetExtension(admin.ImageFile.FileName); //filename = admin.Id + extension; service.Images = "/Images/Newspaper/" + fileName1; string filename = Path.Combine(Server.MapPath("~/Images/Newspaper/"), fileName1); ImageFile.SaveAs(filename); } try { db.SaveChanges(); String Operation = "Service Updated Sucessfully"; db.ActivityLog.Add(new ActivityLog { Operation = Operation, CreatedBy = Session["userEmail"].ToString(), CreatedDate = DateTime.Now }); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } } return(View(service)); }
public ActionResult Edit(Customer customer) { if (ModelState.IsValid) { customer.RegisterDate = DateTime.Now; customer.RegisteredBy = Session["userEmail"].ToString(); db.Entry(customer).State = EntityState.Modified; try { db.SaveChanges(); String Operation = "Customer Updated Sucessfully"; db.ActivityLog.Add(new ActivityLog { BranchId = customer.BranchId, Operation = Operation, CreatedBy = Session["userEmail"].ToString(), CreatedDate = DateTime.Now }); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } } return(View(customer)); //if (Session["Category"].ToString() == "SuperAdmin") //{ // if (ModelState.IsValid) // { // customer.RegisterDate = DateTime.Now; // customer.RegisteredBy = Session["userEmail"].ToString(); // db.Entry(customer).State = EntityState.Modified; // try // { // db.SaveChanges(); // String Operation = "Customer Updated Sucessfully"; // db.ActivityLog.Add(new ActivityLog // { // BranchId = customer.BranchId, // Operation = Operation, // CreatedBy = Session["userEmail"].ToString(), // CreatedDate = DateTime.Now // }); // db.SaveChanges(); // return RedirectToAction("Index"); // } // catch // { // return View(); // } // } // return View(customer); //} //else //{ // if (ModelState.IsValid) // { // int BranchId = Convert.ToInt32(Session["BranchId"].ToString()); // customer.BranchId = BranchId; // customer.RegisterDate = DateTime.Now; // customer.RegisteredBy = Session["userEmail"].ToString(); // db.Entry(customer).State = EntityState.Modified; // try // { // db.SaveChanges(); // String Operation = "Customer Updated Sucessfully"; // db.ActivityLog.Add(new ActivityLog // { // BranchId = BranchId, // Operation = Operation, // CreatedBy = Session["userEmail"].ToString(), // CreatedDate = DateTime.Now // }); // db.SaveChanges(); // return RedirectToAction("Index"); // } // catch // { // return View(); // } // } // return View(customer); //} }