Exemplo n.º 1
0
        public IHttpActionResult Login(Login loginModel)
        {
            if (!ModelState.IsValid)
            {
                var getMessage = ModelState.Values.SelectMany(v => v.Errors.Select(d => d.ErrorMessage)).ToList()
                                 .LastOrDefault();
                _httpResponse.Add(bool.FalseString, getMessage);

                return(Ok(_httpResponse));
            }

            UserInfo result = _profileBusiness.Login(loginModel);

            if (result == null)
            {
                return(Ok(_commonRules.SetResponse(bool.FalseString, "DC1000:Invalid Credentials.")));
            }
            else
            {
                return(Ok(JObject.Parse(JsonConvert.SerializeObject(result))));
            }
        }