public ServiceResult Login(LoginViewModel lvm) { _sr = new ServiceResult() { IsValid = true, Error = new ServiceError() }; var pass = _utilities.CreateMD5Hash(lvm.Password); var user = _repo.Login(lvm.Email.ToLower(), pass); if (user == null) { _sr.IsValid = false; _sr.Error.ErrorMessage = "¡Incorrect user or password!"; return(_sr); } _sr.ContentResult = JsonConvert.SerializeObject(user); return(_sr); }