Exemple #1
0
        public async Task <IActionResult> Get([FromRoute] Guid subdivisionId)
        {
            try
            {
                var subdivision = await _subdivisionUseCases.Get(subdivisionId);

                var preview  = _mapper.Map <List <FilePreview> >(subdivision.Files);
                var exhibits = subdivision.Exhibits;
                subdivision.Exhibits = null;
                return(Ok(new
                {
                    Subdivision = subdivision,
                    Files = preview,
                    Exhibits = _mapper.Map <List <ExhibitView> >(exhibits)
                }));
            }
            catch (NotFoundException e)
            {
                return(NotFound(e.Message));
            }
        }
Exemple #2
0
        public async Task AcceptRequestForExhibit(Guid notificationId)
        {
            var notify = await _notificationUseCases.Get(notificationId);

            var subdivision = await _subdivisionUseCases.Get(notify.SubdivisionId);

            var exhibit = await _exhibitRepository.Get(notify.ExhibitId);

            var record = new Record
            {
                Exhibit  = exhibit,
                Arrived  = exhibit.Subdivision,
                Departed = subdivision
            };
            await _recordRepository.AddRow(record);

            exhibit.Subdivision = subdivision;
            await _exhibitRepository.Update(exhibit);

            await SendRequestForExhibitNotify(notify, exhibit);
        }