public async Task <IHttpActionResult> PutCustomer(int id, Customer customer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customer.customerID) { return(BadRequest()); } db.Entry(customer).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutServiceRequest(int id, ServiceRequest serviceRequest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != serviceRequest.id) { return(BadRequest()); } db.Entry(serviceRequest).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceRequestExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult ApproveBooking(int?id) { if (id == null) { return(Content("ID is null")); } try { ServiceRequest service = db.ServiceRequests.Find(id); if (service != null) { service.verified = true; db.Entry(service).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception Ex) { ViewBag.ErrorMessage = Ex.Message; return(View("Error")); } return(RedirectToAction("Index", "MemberHome")); }
public ActionResult Edit([Bind(Include = "freelancerID,freelancerName,freelancerSurname,freelancerEmail,freelancerPhone,freelancerAddress,city,postalCode,freelancerWebsite,occupation,bio,imageURL")] FreelancerClient freelancer) { try { if (ModelState.IsValid) { freelancer.occupation = "CRP"; db.Entry(freelancer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "MemberHome")); } } catch (Exception Ex) { ViewBag.ErrorMessage = Ex.Message; return(View("Error")); } return(Content("There's a error in this method")); }
public async Task <ActionResult> Edit([Bind(Include = "departmentCode,departmentName")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(department)); }
public async Task <ActionResult> Edit([Bind(Include = "customerID,customerName,customerSurname,customerAddress,customerCity,customerEmail,customerPhone,postalCode")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index", "Home")); } return(View(customer)); }
public async Task <ActionResult> Edit([Bind(Include = "jobCode,jobDescription,freelancerID,hourlyRate,baseRate,imageURL")] Job job) { if (ModelState.IsValid) { db.Entry(job).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.freelancerID = new SelectList(db.FreelancerClients, "freelancerID", "freelancerName", job.freelancerID); return(View(job)); }
public async Task <ActionResult> Edit([Bind(Include = "freelancerID,freelancerName,freelancerSurname,freelancerEmail,freelancerPhone,freelancerAddress,city,postalCode,freelancerWebsite,occupation,bio,imageURL")] FreelancerClient freelancerClient) { if (ModelState.IsValid) { db.Entry(freelancerClient).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.occupation = new SelectList(db.Departments, "departmentCode", "departmentName", freelancerClient.occupation); return(View(freelancerClient)); }
public async Task <ActionResult> Edit([Bind(Include = "id,userID,userName,userPassword,emailStatus,registerDate,userRole,freelancerID")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.userID = new SelectList(db.Customers, "customerID", "customerName", user.customerId); ViewBag.freelancerID = new SelectList(db.FreelancerClients, "freelancerID", "freelancerName", user.freelancerID); return(View(user)); }
public ActionResult Edit([Bind(Include = "jobCode, jobDescription, freelancerID, hourlyRate, baseRate, imageURL")] Job job) { try { if (ModelState.IsValid) { db.Entry(job).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "MemberHome")); } } catch (Exception Ex) { ViewBag.ErrorMessage = Ex.Message; return(View("Error")); } return(View()); }