public async Task <IActionResult> PutPurchasedItems(int id, PurchasedItems purchasedItems)
        {
            if (id != purchasedItems.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PutPageViewCount(int id, PageViewCount pageViewCount)
        {
            if (id != pageViewCount.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #3
0
        public async Task <IActionResult> PutUsers(int id, Users user)
        {
            if (id != user.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> Create([Bind("Id,Url,Count")] PageViewCount pageViewCount)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pageViewCount);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pageViewCount));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Email,UserRole,Password,Mobile")] Users users)
        {
            if (ModelState.IsValid)
            {
                _context.Add(users);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Пример #6
0
        public async Task <IActionResult> Create([Bind("Id,Name,Address,VendorCompany,VendorEmail")] Vendor vendor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vendor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vendor));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Description,Image,TotalItems")] Categories categories)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categories);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(categories));
        }
Пример #8
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,Quantity,PerItemPrice,Images,Color,Model,CategoryId,VendorId")] Items items)
        {
            if (ModelState.IsValid)
            {
                _context.Add(items);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Description", items.CategoryId);
            ViewData["VendorId"]   = new SelectList(_context.Vendor, "Id", "Name", items.VendorId);
            return(View(items));
        }
Пример #9
0
        public async Task <IActionResult> Create([Bind("Id,ItemCategory,Item,ItemCount,PurchasedDate,PerItemPrice")] PurchasedItems purchasedItems)
        {
            if (ModelState.IsValid)
            {
                _context.Add(purchasedItems);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ItemCategory"] = new SelectList(_context.Categories, "Id", "Description", purchasedItems.ItemCategory);
            ViewData["Item"]         = new SelectList(_context.Items, "Id", "Color", purchasedItems.Item);
            return(View(purchasedItems));
        }
Пример #10
0
        public async Task <IActionResult> Create([Bind("Id,CustomerId,SaledDate,CategoryId,ItemId,ItemCount,TotalBill")] SaledItems saledItems)
        {
            if (ModelState.IsValid)
            {
                _context.Add(saledItems);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Description", saledItems.CategoryId);
            ViewData["CustomerId"] = new SelectList(_context.Users, "Id", "Name", saledItems.CustomerId);
            ViewData["ItemId"]     = new SelectList(_context.Items, "Id", "Color", saledItems.ItemId);
            return(View(saledItems));
        }