public IActionResult Index() { var claims = User.Claims.ToList(); ResponseClass <CabinetModel> cabinet = _repository.GetCabinet(claims[0].Value, claims[2].Value, claims[1].Value); RequestClass <dynamic> request = new RequestClass <dynamic>(); request.Login = claims[0].Value; request.Token = claims[1].Value; request.Password = claims[2].Value; ResponseClass <List <TarifModel> > requestTarif = _repository.GetTarifByAgent(request); if (cabinet.Code != 0) { ViewBag.Message = "Ошибка при получении информации по кабинету"; return(View()); } else { ViewBag.Data = requestTarif.Data; return(View(cabinet.Data)); } }
public ResponseClass <CabinetModel> GetCabinet(RequestClass <dynamic> request) { try { if (!_repositoryGuard.IsValid(request.Login, request.Password, request.Token)) { throw new Exception("Неверные данные авторизации"); } ResponseClass <CabinetModel> response = new ResponseClass <CabinetModel>(); response.Data = _repositoryCabinet.GetCabinet(request.Login); response.Code = 0; response.Message = "Success"; return(response); } catch (Exception e) { ResponseClass <CabinetModel> response = new ResponseClass <CabinetModel>(); response.Code = -1; response.Message = e.Message; return(response); } }
public ResponseClass <CabinetModel> GetQuery(RequestClass <dynamic> request) { return(_repositoryCab.GetCabinet(request.Login, request.Password, request.Token)); }