public async Task <IActionResult> EditCustomerProfile(CustomerProfileViewModel editCustomerProfile)
        {
            var username = User.Identity.Name;
            var user     = await _userManager.FindByNameAsync(username);

            var customer = await _customerService.GetCustomerByUserId(user.Id);

            var profile = _mapper.Map <CustomerProfileDto>(editCustomerProfile);

            if (editCustomerProfile.ImageFile != null)
            {
                byte[] imageData = null;
                using (var binaryReader = new BinaryReader(editCustomerProfile.ImageFile.OpenReadStream()))
                {
                    imageData = binaryReader.ReadBytes((int)editCustomerProfile.ImageFile.Length);
                }
                profile.Image = imageData;
            }
            else
            {
                profile.Image = customer.Image;
            }
            await _customerService.Edit(profile);

            return(RedirectToAction("CustomerProfile"));
        }
        public IActionResult Edit(int id, CustomerFormModel customerModel)
        {
            var customerExists = customers.Exists(id);

            if (!customerExists)
            {
                return(RedirectToAction(nameof(All), new { order = "ascending" }));
            }

            if (!ModelState.IsValid)
            {
                return(View(customerModel));
            }

            customers.Edit(customerModel.Id, customerModel.Name, customerModel.BirthDate, customerModel.IsYoungDriver);

            return(RedirectToAction(nameof(All), new { order = "ascending" }));
        }