Пример #1
0
        public async Task <IActionResult> AddNewPhone(PhoneViewModel phoneViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("~/Views/Shared/Phone/_PhoneList", phoneViewModel));
            }

            await _customerService.AddPhone(_mapper.Map <Phone>(phoneViewModel));

            if (!ValidOperation())
            {
                return(PartialView("~/Views/Shared/Phone/_AddPhone", phoneViewModel));
            }

            var url = Url.Action("GetPhonesCustomer", "Customers", new { id = phoneViewModel.CustomerId });

            return(Json(new { success = true, url }));
        }