Ejemplo n.º 1
0
        public IActionResult Edit(long id, [Bind("DetailID,DetailMainID,DetailSubID,SelectProductTypes")] Detail detail)
        {
            if (id != detail.DetailID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    service.Update(detail);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DetailExists(detail.DetailID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DetailMainID"]         = new List <SelectListItem>(service.GetSelectListDetailMains());
            ViewData["DetailSubID"]          = new List <SelectListItem>(service.GetSelectListDetailSubs());
            ViewData["SelectedProductTypes"] = new List <SelectListItem>(service.GetSelectListProductTypes());
            return(View(detail));
        }
Ejemplo n.º 2
0
        public void Update(DetailViewModel detail)
        {
            var detailUpdate = new DetailModel()
            {
                Id    = detail.Id,
                CarID = detail.CarID,
                Name  = detail.Name
            };

            service.Update(detailUpdate);
        }
Ejemplo n.º 3
0
        public void Update(DetailViewModel detailViewModel)
        {
            var detailModel = new DetailModel
            {
                Id   = 1,
                Name = "PeterDetail",
                Cost = 000000,
            };

            _dbDetail.Update(detailModel);
        }
Ejemplo n.º 4
0
        public void Update(DetailViewModel detailView)
        {
            var detailToUpdate = new DetailModel()
            {
                Id             = detailView.Id,
                CarId          = detailView.CarId,
                Name           = detailView.Name,
                Price          = detailView.Price,
                DetailTypeId   = detailView.DetailTypeId,
                ManufacturerId = detailView.ManufacturerId
            };

            detailService.Update(detailToUpdate);
        }