public async Task <IActionResult> PutCustomerTbl([FromRoute] int id, [FromBody] CustomerTbl customerTbl) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customerTbl.Id) { return(BadRequest()); } _context.Entry(customerTbl).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerTblExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IHttpActionResult PutCustomerTbl(long id, CustomerTbl customerTbl) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != customerTbl.CustomerID) { return BadRequest(); } db.Entry(customerTbl).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CustomerTblExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public ActionResult DeleteConfirmed(int id) { CustomerTbl customerTbl = db.CustomerTbls.Find(id); db.CustomerTbls.Remove(customerTbl); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Customer_ID,Customer_Name,Customer_IC,Customer_DateBirth,Customer_Address,Customer_Contact,Customer_Vessel")] CustomerTbl customerTbl) { if (ModelState.IsValid) { db.Entry(customerTbl).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerTbl)); }
public IHttpActionResult GetCustomerTbl(long id) { CustomerTbl customerTbl = db.CustomerTbls.Find(id); if (customerTbl == null) { return NotFound(); } return Ok(customerTbl); }
public ActionResult Create([Bind(Include = "Customer_ID,Customer_Name,Customer_IC,Customer_DateBirth,Customer_Address,Customer_Contact,Customer_Vessel")] CustomerTbl customerTbl) { if (ModelState.IsValid) { db.CustomerTbls.Add(customerTbl); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerTbl)); }
public async Task <IActionResult> PostCustomerTbl([FromBody] CustomerTbl customerTbl) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CustomerTbl.Add(customerTbl); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCustomerTbl", new { id = customerTbl.Id }, customerTbl)); }
public IHttpActionResult PostCustomerTbl(CustomerTbl customerTbl) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.CustomerTbls.Add(customerTbl); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = customerTbl.CustomerID }, customerTbl); }
public IHttpActionResult DeleteCustomerTbl(long id) { CustomerTbl customerTbl = db.CustomerTbls.Find(id); if (customerTbl == null) { return NotFound(); } db.CustomerTbls.Remove(customerTbl); db.SaveChanges(); return Ok(customerTbl); }
// GET: CustomerTbls/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerTbl customerTbl = db.CustomerTbls.Find(id); if (customerTbl == null) { return(HttpNotFound()); } return(View(customerTbl)); }
public String CustomerLogin([FromBody] CustomerTbl customerTbl) { var cus = from x in _context.CustomerTbl.Where(x => x.Name == customerTbl.Name && x.Password == customerTbl.Password) select x; if (cus != null && cus.Count() > 0) { Global.UserName = cus.FirstOrDefault().Name; Global.UserID = cus.FirstOrDefault().Id; return("true"); } return("false"); }
public int Edit([FromBody] CustomerTbl c, int Customerid, string Customername) { return(cust.UpdateCustomer(c, Customerid, Customername)); }
public int Create([FromBody] CustomerTbl c, Customer ct, string Customername, string CustomerNo) { return(cust.AddCustomer(c, ct, Customername, CustomerNo)); }
public int Create([FromBody] CustomerTbl c, string CustomerName) { return(cust.AddCustomer(c, CustomerName)); }