Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,LaptopId,FullName,CommentTime,CommentContent,PhoneNumber")] Comment comment)
        {
            if (id != comment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommentExists(comment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LaptopId"] = new SelectList(_context.Laptop, "Id", "NameLap", comment.LaptopId);
            return(View(comment));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CatId,NameLap,Title,Description,Price,Quantity,Size,Weight,Color,Image,Memory,Os,CpuSpeed,Camera,Battery,Waranty,Bluetooth,Wlan,SalePrice,StartPromotion,EndPromotion,CreatedAt,UpdatedAt")] Laptop laptop)
        {
            if (id != laptop.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(laptop);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LaptopExists(laptop.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CatId"] = new SelectList(_context.Categorys, "Id", "Name", laptop.CatId);
            return(View(laptop));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Parent,Slug,Status,CreatedAt,UpdatedAt")] Categorys categorys)
        {
            if (id != categorys.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(categorys);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategorysExists(categorys.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(categorys));
        }