public ActionResult SignInMechanic(SignInMechanicViewModel model) { if (!ModelState.IsValid) { Helpers.InvalidModelState(ModelState); } var mechanicId = _mechanicService.SignInMechanic(model); return(Json(mechanicId)); }
Guid IMechanicService.SignInMechanic(SignInMechanicViewModel model) { _unitOfWork.BeginTransaction(); var mechanic = _mechanicRepository.GetAll().Where(x => x.Email == model.Email && x.Password == model.Password).FirstOrDefault(); if (mechanic == null) { _unitOfWork.Commit(); throw new Exception(ExceptionMessages.MechanicException.NOT_FOUND); } var mechanicId = _mechanicRepository.signIn(mechanic); _unitOfWork.Commit(); return(mechanicId); }