public JsonResult <APIResultEntities <AcountsEntities> > Get(string username, string password) { APIResultEntities <AcountsEntities> rs = new APIResultEntities <AcountsEntities>(); try { var data = _iAccountServices.Authenticate(username, password); if (data != null) { rs.Data = data; rs.ErrCode = ErrorCodeEntites.Success; rs.ErrDescription = string.Format(Constants.MSG_SELECT_SUCCESS, Constants.Account); } else { rs.Data = null; rs.ErrCode = ErrorCodeEntites.HaveNoData; rs.ErrDescription = string.Format(Constants.MSG_SELECT_SUCCESS, Constants.Account); } } catch (Exception ex) { rs.Data = null; rs.ErrCode = ErrorCodeEntites.Fail; rs.ErrDescription = ex.ToString(); throw new Exception(ex.ToString()); } return(Json(rs)); }