Exemple #1
0
        public static void UpdatedPrices(Item itemPrices)
        {
            Item Updated = db.Items.Find(itemPrices.Id);

            Updated.Price1 = itemPrices.Price1;
            Updated.Price2 = itemPrices.Price2;
            Updated.Price3 = itemPrices.Price3;

            db.Entry(Updated).State = EntityState.Modified;
            db.SaveChanges();
        }
Exemple #2
0
        public async Task <TEntity> Delete(int Id)
        {
            var entity = await Get(Id);

            if (entity == null)
            {
                return(entity);
            }
            entity.DeleteDate = DateTimeOffset.Now;
            entity.IsDelete   = true;
            _myContext.Entry(entity).State = EntityState.Modified;
            await _myContext.SaveChangesAsync();

            return(entity);
        }
Exemple #3
0
 public static void RemoveCollectionOrder(int Id)
 {
     using (myContext db1 = new myContext())
     {
         var order = db1.AwaitOrders.First(m => m.Id == Id);
         //db1.AwaitOrders.Remove(order);
         db1.Entry(order).State = EntityState.Deleted;
         db1.SaveChanges();
     }
 }
 public ActionResult Edit(int id, Item item)
 {
     if (ModelState.IsValid)
     {
         // TODO: Add update logic here
         connection.Entry(item).State = EntityState.Modified;
         connection.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Id = new SelectList(connection.Suppliers, "Id", "Name", item.Supplier);
     return(View());
 }
 public ActionResult Edit(int id, Department department)
 {
     try
     {
         myConn.Entry(department).State = EntityState.Modified;
         myConn.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Edit(int id, Division division)
 {
     try
     {
         myConn.Entry(division).State = EntityState.Modified;
         myConn.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         ViewBag.id_department = new SelectList(myConn.Departments, "Id", "Name", division.Name);
         return(View());
     }
 }
 public ActionResult Edit(int id, Supplier supplier)
 {
     try
     {
         // TODO: Add update logic here
         using (myContext connection = new myContext())
         {
             connection.Entry(supplier).State = EntityState.Modified;
             connection.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult Edit(int id, Item item)
        {
            try
            {
                // TODO: Add update logic here
                conn.Entry(item).State = EntityState.Modified;
                conn.SaveChanges();



                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #9
0
        public ActionResult Edit(int id, Customer customer)
        {
            myContext conn = new myContext();

            try
            {
                // TODO: Add update logic here
                conn.Entry(customer).State = EntityState.Modified;
                conn.SaveChanges();



                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }