Exemple #1
0
 public IActionResult Update(CustomerUpdateVM updateVM)
 {
     if (!ModelState.IsValid)
     {
         return(View(updateVM));
     }
     _command.Update(updateVM);
     return(RedirectToAction("List"));
 }
Exemple #2
0
 public IActionResult Update(CustomerUpdateVM customer)
 {
     if (ModelState.IsValid)
     {
         var entity = _mapper.Map <Customer>(customer);
         _unitOfWork.Customer.Update(entity);
     }
     return(RedirectToAction("Index"));
 }
        public void Update(CustomerUpdateVM updateVM)
        {
            _customer.Id        = updateVM.Id;
            _customer.FirstName = updateVM.FirstName;
            _customer.LastName  = updateVM.LastName;
            _customer.UserName  = updateVM.UserName;
            _customer.Password  = updateVM.Password;

            _context.Entry(_customer).State = EntityState.Modified;
            _context.SaveChanges();
        }