Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ImageUrl,Name,Description,Price,RamAndStorage,BatteryCapacity")] LaptopModel laptopModel)
        {
            if (id != laptopModel.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(laptopModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LaptopModelExists(laptopModel.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(laptopModel));
        }
Example #2
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,laptop_id,user_id")] OrderModel orderModel)
        {
            if (id != orderModel.Order_ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orderModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderModelExists(orderModel.Order_ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(orderModel));
        }
Example #3
0
        public async Task <IActionResult> Edit(long id, [Bind("ID,NAME,DSCRIP")] Category category)
        {
            if (id != category.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryExists(category.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Diametru,Sarja,Furnizor,Calitate,IsDatAfara,IsRetur,IsRebut,DataOraLaminare")] Blum blum)
        {
            if (id != blum.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(blum);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BlumExists(blum.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(blum));
        }
Example #5
0
        public async Task <IActionResult> UpdateAsset(Asset data)
        {
            var entity = await _dbContext.Assets.FindAsync(data.Id);

            entity.Name        = data.Name;
            entity.Description = data.Description;
            entity.TagNumber   = data.TagNumber;
            _dbContext.Update(entity);
            await _dbContext.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }