Exemplo n.º 1
0
        public IHttpActionResult Get(int pageIndex = 1, int pageSize = 50)
        {
            var result = new JsonResultModel <PagedResultModel <Client> >()
            {
                Success = false
            };;

            var stopWatch = GetStopWatch();

            try
            {
                result.Result  = clientsService.Get(pageIndex, pageSize);
                result.Success = true;
                stopWatch.Stop();
                LogManager.AddInfo("ClientsController.GET");
            }
            catch (Exception ex)
            {
                stopWatch.Stop();
                LogManager.AddError("ClientsController", "Get", string.Empty, string.Empty, stopWatch.ElapsedTicks, ex);

                result.Message = ex.Message;
            }

            return(Ok(result));
        }
Exemplo n.º 2
0
        public ClientsPageViewModel(IClientsService clientsService, IResidencesService residencesService, ISnackbarMessageQueue snackbarMessageQueue, IDialogHost dialogHost, Hotel hotel)
        {
            _clientsService       = clientsService;
            _residencesService    = residencesService;
            _snackbarMessageQueue = snackbarMessageQueue;
            _hotel      = hotel;
            _dialogHost = dialogHost;


            Clients = new ObservableCollection <Client>(_clientsService.Get());

            ClientsViews        = (CollectionView)CollectionViewSource.GetDefaultView(Clients);
            ClientsViews.Filter = ClientsFilter;


            FilteredFields = new Dictionary <string, string>(Client.Fields)
            {
                { AnyFieldFilterValue, "Любое поле" }
            };
            SelectedFilterField = AnyFieldFilterValue;
            IsContainsFilter    = true;

            SortedFields = new Dictionary <string, string>(Client.Fields)
            {
                { NoSortingSortValue, "Не сортировать" }
            };
            SelectedSortField = NoSortingSortValue;
            IsAscendingSort   = true;
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Get([FromRoute] int id)
        {
            var client = await _clientsService.Get(id);

            return(Ok(client));
        }
Exemplo n.º 4
0
 public HttpResponseMessage Get()
 {
     return(ToJson(Mapper.Map <IEnumerable <Clients>, IEnumerable <ClientViewModel> >(_clientsService.Get())));
 }