Esempio n. 1
0
        public async Task <ActionResult <BrandApi> > Update(UpdateBrandApiRequest request)
        {
            var model    = _mapper.Map <UpdateBrand>(request);
            var response = await _brandManager.Update(model);

            var modelApi = _mapper.Map <BrandApi>(response);

            return(Ok(modelApi));
        }
Esempio n. 2
0
        public IActionResult Update(Brand brand)
        {
            var result = _brandManager.Update(brand);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Esempio n. 3
0
        public async Task <IActionResult> Update(UpdateBrandViewModel updateBrandViewModel)
        {
            if (ModelState.IsValid)
            {
                Brand updateBrand = _iMapper.Map <Brand>(updateBrandViewModel);
                bool  isAdd       = await _iBrandManager.Update(updateBrand);

                if (isAdd)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.ErrorMessage = "Failed to Update Brand";
                }
            }

            return(View(updateBrandViewModel));
        }