public async Task <IActionResult> Edit(int id, [Bind("Id,Customer_Name,Email,Phone")] Customer_Detail customer_Detail) { if (id != customer_Detail.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer_Detail); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Customer_DetailExists(customer_Detail.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer_Detail)); }
public IHttpActionResult PutCustomer_Detail(long id, Customer_Detail customer_Detail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customer_Detail.CustomerID) { return(BadRequest()); } db.Entry(customer_Detail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Customer_DetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> Create([Bind("Id,Customer_Name,Email,Phone")] Customer_Detail customer_Detail) { if (ModelState.IsValid) { _context.Add(customer_Detail); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer_Detail)); }
public IHttpActionResult GetCustomer_Detail(long id) { Customer_Detail customer_Detail = db.Customer_Detail.Find(id); if (customer_Detail == null) { return(NotFound()); } return(Ok(customer_Detail)); }
public IHttpActionResult PostCustomer_Detail(Customer_Detail customer_Detail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Customer_Detail.Add(customer_Detail); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = customer_Detail.CustomerID }, customer_Detail)); }
public IHttpActionResult DeleteCustomer_Detail(long id) { Customer_Detail customer_Detail = db.Customer_Detail.Find(id); if (customer_Detail == null) { return(NotFound()); } db.Customer_Detail.Remove(customer_Detail); db.SaveChanges(); return(Ok(customer_Detail)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Customer_Detail = await _context.Customer_Detail.FirstOrDefaultAsync(m => m.Id == id); if (Customer_Detail == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Customer_Detail = await _context.Customer_Detail.FindAsync(id); if (Customer_Detail != null) { _context.Customer_Detail.Remove(Customer_Detail); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }