public void Update(UpdateMechanicViewModel model)
        {
            _unitOfWork.BeginTransaction();

            var mechanic = _mechanicRepository.GetById(model.Id);

            if (mechanic == null)
            {
                _unitOfWork.Commit();
                throw new Exception(ExceptionMessages.MechanicException.NOT_FOUND);
            }

            mechanic.UserName    = model.UserName;
            mechanic.Email       = model.Email;
            mechanic.Password    = model.Password;
            mechanic.CompanyName = model.CompanyName;
            mechanic.City        = model.City;
            mechanic.Country     = model.Country;
            mechanic.PostalCode  = model.PostalCode;
            mechanic.Address     = model.Address;

            _mechanicRepository.Update(mechanic);
            _unitOfWork.Commit();
        }
Exemple #2
0
 public ActionResult Update(UpdateMechanicViewModel model)
 {
     _mechanicService.Update(model);
     return(Json(true));
 }