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());
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            CustomerTbl customerTbl = db.CustomerTbls.Find(id);

            db.CustomerTbls.Remove(customerTbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 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));
 }
コード例 #5
0
        public IHttpActionResult GetCustomerTbl(long id)
        {
            CustomerTbl customerTbl = db.CustomerTbls.Find(id);
            if (customerTbl == null)
            {
                return NotFound();
            }

            return Ok(customerTbl);
        }
コード例 #6
0
        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));
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        // 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");
        }
コード例 #12
0
 public int Edit([FromBody] CustomerTbl c, int Customerid, string Customername)
 {
     return(cust.UpdateCustomer(c, Customerid, Customername));
 }
コード例 #13
0
 public int Create([FromBody] CustomerTbl c, Customer ct, string Customername, string CustomerNo)
 {
     return(cust.AddCustomer(c, ct, Customername, CustomerNo));
 }
コード例 #14
0
 public int Create([FromBody] CustomerTbl c, string CustomerName)
 {
     return(cust.AddCustomer(c, CustomerName));
 }