public ActionResult Edit([Bind(Include = "Id,AppointmentId,ServiceProviderId,TotalAmount,ServiceProviderRevenue,CompanyRevenue")] Transaction transaction) { if (ModelState.IsValid) { db.Entry(transaction).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ServiceProviderId = new SelectList(db.Accounts, "Id", "Username", transaction.ServiceProviderId); ViewBag.AppointmentId = new SelectList(db.Appointments, "Id", "Location", transaction.AppointmentId); return(View(transaction)); }
public ActionResult Edit([Bind(Include = "Id,Username,Password,Name,Email,Mobile,Gender,DateOfBirth,Address,ProfilePicture,UserType,CustomerId,ServiceProviderId")] Account account) { if (Session["user-type"] == null || Session["user-type"].ToString() != "1") { return(Redirect("/")); } if (ModelState.IsValid) { db.Entry(account).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(db.Customers, "Id", "Id", account.CustomerId); ViewBag.ServiceProviderId = new SelectList(db.ServiceProviders, "Id", "Coverage", account.ServiceProviderId); ViewBag.UserType = new SelectList(db.UserTypes, "Id", "Title", account.UserType); return(View(account)); }
public void Update(TEntity entity) { context.Entry(entity).State = EntityState.Modified; }