public void Edited(ItemCategoryDTO obj)
        {
            ItemCategory EditedCategory = _db.ItemCategories.Where(x => x.ItemCategoryId == obj.ItemCategoryId).FirstOrDefault();

            EditedCategory.ItemCategoryId   = obj.ItemCategoryId;
            EditedCategory.ItemCategoryName = obj.ItemCategoryName;
            EditedCategory.SignUpId         = obj.SignUpId;
            _db.Entry(EditedCategory).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _db.SaveChanges();
        }
Exemplo n.º 2
0
        public void EditDetails(SignUpDTO obj)
        {
            SignUp signupobj = _db.SignUps.Where(x => x.SignUpId == obj.SignUpId).FirstOrDefault();

            signupobj.Active      = obj.Active;
            signupobj.Address     = obj.Address;
            signupobj.Email       = obj.Email;
            signupobj.FullName    = obj.FullName;
            signupobj.LoginType   = obj.LoginType;
            signupobj.Password    = obj.Password;
            signupobj.PhoneNumber = obj.PhoneNumber;
            signupobj.SignUpId    = obj.SignUpId;

            _db.Entry(signupobj).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _db.SaveChanges();
        }
Exemplo n.º 3
0
 public void Delete(T entity)
 {
     if (_dbContext.Entry(entity).State == EntityState.Detached)
     {
         _dbSet.Attach(entity);
     }
     _dbSet.Remove(entity);
 }
Exemplo n.º 4
0
        public void UpdatingTheCartItem(CartItem cartItem)
        {
            var curr = _context.CartItems.SingleOrDefault(x => x.Id == cartItem.Id);

            if (curr != null)
            {
                curr.Quantity = cartItem.Quantity;

                _context.Entry(curr);
                _context.SaveChanges();
            }
        }
        public void AddItem(ItemDTO obj)
        {
            //Item AddItemDetails = _db.Items.Where(x => x.SignUpId == obj.SignUpId).FirstOrDefault();
            Item AddItemDetails = new Item();

            AddItemDetails.ItemName       = obj.ItemName;
            AddItemDetails.ItemCode       = obj.ItemCode;
            AddItemDetails.ImageUrl1      = obj.ImageUrl1;
            AddItemDetails.ImageUrl2      = obj.ImageUrl2;
            AddItemDetails.ImageUrl3      = obj.ImageUrl3;
            AddItemDetails.ImageUrl4      = obj.ImageUrl4;
            AddItemDetails.Description    = obj.Description;
            AddItemDetails.Quantity       = obj.Quantity;
            AddItemDetails.UnitPrice      = obj.UnitPrice;
            AddItemDetails.SignUpId       = obj.SignUpId;
            AddItemDetails.ItemCategoryId = obj.ItemCategoryId;


            _db.Entry(AddItemDetails).State = Microsoft.EntityFrameworkCore.EntityState.Added;
            _db.SaveChanges();
        }
Exemplo n.º 6
0
 public void Update(T obj)
 {
     table.Attach(obj);
     context.Entry(obj).State = EntityState.Modified;
 }
Exemplo n.º 7
0
 public void UpdateCart(Cart cart)
 {
     _context.Entry(cart);
     _context.SaveChanges();
 }