Esempio n. 1
0
        public async Task <IActionResult> PutVendor(int id, Vendor vendor)
        {
            if (id != vendor.Id)
            {
                return(BadRequest());
            }

            _context.Entry(vendor).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VendorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutInvoice(int id, Invoice invoice)
        {
            if (id != invoice.Id)
            {
                return(BadRequest());
            }

            _context.Entry(invoice).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InvoiceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 3
0
        public async Task <IActionResult> PutAddress(int id, Address address)
        {
            if (id != address.Id)
            {
                return(BadRequest());
            }

            _context.Entry(address).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AddressExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "ID,Name,Address,Tel,Creditlimit")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "ID,Name,Active")] Item item)
 {
     if (ModelState.IsValid)
     {
         db.Entry(item).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(item));
 }
 public ActionResult Edit([Bind(Include = "ID,InvoiceDate,ItemTotal,Discount,Tax,InvoiceTotal,CustomerID")] Invoice invoice)
 {
     if (ModelState.IsValid)
     {
         db.Entry(invoice).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.CustomerID = new SelectList(db.Customer, "ID", "Name", invoice.CustomerID);
     return View(invoice);
 }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "Id,Name,Address,Email,WebAddress,Phone,FinancialYearId")] Shop shop)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shop).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FinancialYearId = new SelectList(db.FinancialYears, "Id", "Name", shop.FinancialYearId);
     return(View(shop));
 }
 public ActionResult Edit([Bind(Include = "ID,EffectiveDate,UnitPrice,Active,ItemID")] ItemDetail itemDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(itemDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ItemID = new SelectList(db.Item, "ID", "Name", itemDetail.ItemID);
     return(View(itemDetail));
 }
Esempio n. 9
0
 public ActionResult Edit([Bind(Include = "Id,Name,Stock,BarCode,ShopId,MeasurementId")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MeasurementId = new SelectList(db.Measurements, "Id", "Name", product.MeasurementId);
     ViewBag.ShopId        = new SelectList(db.Shops, "Id", "Name", product.ShopId);
     return(View(product));
 }
Esempio n. 10
0
 public ActionResult AddorEdit_Product(Product prod)//we have to pass instance of object in defined stages of enity that's we have created instance
 {
     using (PosContext db = new PosContext())
     {
         if (prod.ProductId == 0)
         {
             db.Products.Add(prod);
             db.SaveChanges();
             return(Json(new { success = true, message = "saved Successfully" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(prod).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "saved Successfully" }, JsonRequestBehavior.AllowGet));
         }
     }
 }
Esempio n. 11
0
 public bool Update(Measurement measurement)
 {
     db.Entry(measurement).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }
Esempio n. 12
0
 public bool Update(FinancialYear financialYear)
 {
     db.Entry(financialYear).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }
Esempio n. 13
0
        public static bool UpdateLog(Log entity)
        {
            try
            {
                using (var ctx = new PosContext())
                {

                    if (entity == null) throw new ArgumentNullException("Log not found with Id " + entity.Id);
                    InsertLogArchive(entity);
                    ctx.Entry(entity).State = EntityState.Modified;
                    ctx.SaveChanges();
                    return true;
                }

            }
            catch (Exception ex)
            {
                return false;
            }
        }
Esempio n. 14
0
 public bool Update(Category category)
 {
     db.Entry(category).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }
Esempio n. 15
0
 public bool Update(Shop shop)
 {
     db.Entry(shop).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }
Esempio n. 16
0
 public bool Update(Product product)
 {
     db.Entry(product).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }
Esempio n. 17
0
 public bool Update(Brand brand)
 {
     db.Entry(brand).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }