示例#1
0
        public void Edit(Guid?Id, User model)
        {
            User user = db.Users.Find(Id);

            user.FullName = model.FullName;
            user.Email    = model.Email;
            user.Password = model.Password;
            user.Phone    = model.Phone;
            user.Address  = model.Address;
            user.status   = model.status;
            if (model.Image == null)
            {
                user.Image = user.Image;
            }
            else
            {
                user.Image = model.Image;
            }


            user.UpdatedAt = DateTime.Now;

            db.Entry(user).State = EntityState.Modified;
            db.SaveChanges();
        }
示例#2
0
        public void Edit(Guid?Id, Product product)
        {
            Product model = db.Products.Find(Id);

            model.Name        = product.Name;
            model.Description = product.Description;
            if (product.Image == null)
            {
                model.Image = model.Image;
            }
            else
            {
                model.Image = product.Image;
            }
            model.Unit           = product.Unit;
            model.UnitPrice      = product.UnitPrice;
            model.PromotionPrice = product.PromotionPrice;
            model.TypeProductId  = product.TypeProductId;
            model.NewId          = product.NewId;
            model.status         = product.status;

            model.UpdatedAt       = DateTime.Now;
            db.Entry(model).State = EntityState.Modified;
            db.SaveChanges();
        }
示例#3
0
        public void Edit(Guid?Id, Bill bill)
        {
            Bill model = db.Bills.Find(Id);

            model.CustomerId = bill.CustomerId;
            model.DateOrder  = bill.DateOrder;
            model.Total      = bill.Total;
            model.Note       = bill.Note;

            model.UpdatedAt = DateTime.Now;

            db.Entry(model).State = EntityState.Modified;
            db.SaveChanges();
        }
示例#4
0
        public void Edit(Guid?Id, BillDetail billDetail)
        {
            BillDetail model = db.BillDetails.Find(Id);

            model.BillId    = billDetail.BillId;
            model.ProductId = billDetail.ProductId;
            model.Quantity  = billDetail.Quantity;
            //model.UnitPrice = billDetail.UnitPrice;
            model.status = billDetail.status;

            model.UpdatedAt = DateTime.Now;

            db.Entry(model).State = EntityState.Modified;
            db.SaveChanges();
        }
示例#5
0
        public void Edit(Guid?Id, Customer customer)
        {
            Customer model = db.Customers.Find(Id);

            model.Name    = customer.Name;
            model.Gender  = customer.Gender;
            model.Email   = customer.Email;
            model.Address = customer.Address;
            model.Phone   = customer.Phone;
            model.Note    = customer.Note;
            model.status  = customer.status;

            model.UpdatedAt = DateTime.Now;

            db.Entry(model).State = EntityState.Modified;
            db.SaveChanges();
        }
示例#6
0
        public void Edit(Guid?Id, NewProduct newProduct)
        {
            NewProduct model = db.NewProducts.Find(Id);

            model.Title   = newProduct.Title;
            model.Context = newProduct.Context;

            if (newProduct.Image == null)
            {
                model.Image = model.Image;
            }
            else
            {
                model.Image = newProduct.Image;
            }
            model.status    = newProduct.status;
            model.UpdatedAt = DateTime.Now;

            db.Entry(model).State = EntityState.Modified;
            db.SaveChanges();
        }
示例#7
0
        public void Edit(Guid?Id, TypeProduct typeProduct)
        {
            TypeProduct model = db.TypeProducts.Find(Id);

            model.Name        = typeProduct.Name;
            model.Description = typeProduct.Description;

            if (typeProduct.Image == null)
            {
                model.Image = model.Image;
            }
            else
            {
                model.Image = typeProduct.Image;
            }
            model.status    = typeProduct.status;
            model.UpdatedAt = DateTime.Now;

            db.Entry(model).State = EntityState.Modified;
            db.SaveChanges();
        }