예제 #1
0
        public ActionResult SignInMechanic(SignInMechanicViewModel model)
        {
            if (!ModelState.IsValid)
            {
                Helpers.InvalidModelState(ModelState);
            }
            var mechanicId = _mechanicService.SignInMechanic(model);

            return(Json(mechanicId));
        }
예제 #2
0
        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);
        }