protected async Task ClearCommentBranch(RootDto root, IEnumerable <string> ids)
        {
            var path = new List <(string nestedArrayName, string itemId)>();

            foreach (var id in ids)
            {
                var child = await FindChild(root.Comments, id);

                if (child.IsDeleted && !HasActiveComments(child.Comments))
                {
                    var rootId  = root.Id;
                    var childId = child.Id;

                    await _childCommentRepository.PullAsync(
                        rootId,
                        childId,
                        path,
                        "Comments");

                    return;
                }

                path.Add(("Comments", id));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> UpdateDoctor(Guid rootId, [FromBody] RootDto root)
        {
            await _rootService.UpdateRoot(rootId, root.Street, root.PostCode,
                                          root.PhoneNumber, root.City);

            return(NoContent());
        }
Exemplo n.º 3
0
        public RootDto Fetch(Guid criteria)
        {
            RootDto result = new RootDto();

            result.BusinessItemDtos = listDal.Fetch(criteria);

            return(result);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Post([FromBody] RootDto root)
        {
            await _rootService.AddRoot(root.Email, root.Password, root.Pesel,
                                       root.FirstName, root.SecondName, root.PhoneNumber, root.PostCode,
                                       root.City, root.Street, root.HouseNumber);

            return(Created("/roots/5", null));
        }
Exemplo n.º 5
0
        public RootDto Fetch()
        {
            RootDto result = new RootDto();

            result.BusinessItemDtos = listDal.Fetch();

            return(result);
        }
 public AutoCompleteRootDisplayModel(RootDto root)
 {
     this.Id          = root.Id;
     this.Type        = root.Type;
     this.Name        = root.Name;
     this.Mean        = root.Mean;
     this.ChineseMean = root.ChineseMean;
 }
        public async Task <List <RootDto> > QueryRoot(RootDto searchModel)
        {
            List <RootDto> result = new List <RootDto>();
            List <Root>    roots  = mRootRepository.GetAll(p => p.Id == searchModel.Id && p.Name == searchModel.Name).ToList();

            result.AddRange(roots.Select(p => Mapper.Map <RootDto>(p)));

            return(result);
        }
        public BindableCollection <InputModel> Resolve(RootDto source, RootDisplayModel destination, BindableCollection <InputModel> destMember, ResolutionContext context)
        {
            BindableCollection <InputModel> result = new BindableCollection <InputModel>();

            result.AddRange(source.DerivativeList.Select(p => new InputModel()
            {
                Name = p
            }));
            return(result);
        }
 public async Task AddOrUpdateRoot(RootDto rootDto)
 {
     if (rootDto.Id <= 0)
     {
         mRootRepository.Insert(Mapper.Map <Root>(rootDto), null);
     }
     else
     {
         mRootRepository.Update(Mapper.Map <Root>(rootDto), null);
     }
 }
Exemplo n.º 10
0
        public void SaveDto()
        {
            // Gather the DTO tree
            // Keep hooks in place so that I can
            // send back the DTO to it's "RIGHTFUL OWNER"

            var dto = new RootDto();

            dto.BusinessItemDtos = BusinessItemList.CreateDtos();

            DtoPortal.Update(dto);
        }
Exemplo n.º 11
0
        public HttpResponseMessage Get()
        {
            try
            {
                var results = new RootDto
                {
                    LogProfilesAsOwner  = _mapper.ToLogProfilesDto(_logManager.ModelReader.GetLogProfilesAsOwnerWithoutRelatedEntities(User.Identity.Name)),
                    LogProfilesAsFriend = _mapper.ToLogProfilesDto(_logManager.ModelReader.GetLogProfilesAsFriend(User.Identity.Name))
                };

                return(Request.CreateResponse(HttpStatusCode.Accepted, results, "application/json"));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.GetBaseException()));
            }
        }
        public RootDto GetJson()
        {
            var version    = _versionService.Version;
            var versionDto = new RootDto
            {
                Major     = version.Major,
                Minor     = version.Minor,
                Patch     = version.Patch,
                Qualifier = version.Qualifier
            };


            // Adding Features (HAL-LinkRelations)
            versionDto._links.Add(VacationRequestController.ValuesRelation, new RelationDataDto(Url.RouteUrl($"{nameof(VacationRequestController)}.{nameof(VacationRequestController.GetVacationList)}")));
            // Add Features to the ConfigApp (not available yet)
            versionDto._links.Add(ConfigFeaturesController.ConfigFeatures, new RelationDataDto(Url.RouteUrl(nameof(ConfigFeaturesController) + "." + nameof(ConfigFeaturesController.GetConfigFeatures), null)));
            versionDto._links.Add(HomeFeatureController.FeaturesDescription, new RelationDataDto(Url.RouteUrl(nameof(HomeFeatureController) + "." + nameof(HomeFeatureController.GetFeaturesDescriptions))));
            return(versionDto);
        }
Exemplo n.º 13
0
        public RootDto GetJson()
        {
            var version    = _versionService.Version;
            var versionDto = new RootDto
            {
                Major     = version.Major,
                Minor     = version.Minor,
                Patch     = version.Patch,
                Qualifier = version.Qualifier
            };

            versionDto._links.Add("dmsobjectextensions", new RelationDataDto(Url.RouteUrl($"{nameof(QualityManagementController)}.{nameof(QualityManagementController.GetDmsExtension)}")));
            // Adding Features (HAL-LinkRelations)
            versionDto._links.Add("sources", new RelationDataDto(Url.RouteUrl($"{nameof(QualityManagementController)}.{nameof(QualityManagementController.GetDmsSources)}")));
            // Add Features to the ConfigApp (not available yet)
            versionDto._links.Add(ConfigFeaturesController.ConfigFeatures, new RelationDataDto(Url.RouteUrl(nameof(ConfigFeaturesController) + "." + nameof(ConfigFeaturesController.GetConfigFeatures), null)));
            versionDto._links.Add(HomeFeatureController.FeaturesDescription, new RelationDataDto(Url.RouteUrl(nameof(HomeFeatureController) + "." + nameof(HomeFeatureController.GetFeaturesDescriptions))));
            return(versionDto);
        }
        protected async Task <int> Delete(IEnumerable <string> ids, string rootId, string childId)
        {
            var          path         = ids.Skip(1).SkipLast(1).Select(x => ("Comments", x)).ToList();
            UpdateResult updateResult = await _childCommentRepository.PullAsync(
                rootId,
                childId,
                path,
                "Comments");

            RootDto rootComment = await _bookRootCommentService.GetById(rootId);

            if (rootComment.IsDeleted && !HasActiveComments(rootComment.Comments))
            {
                await _bookRootCommentService.Remove(rootId);
            }
            else if (rootComment.Comments.Any())
            {
                await ClearCommentBranch(rootComment, ids.Skip(1).SkipLast(1));
            }

            return((int)updateResult.ModifiedCount);
        }
Exemplo n.º 15
0
        public async Task GetById_BookRootCommentExists_Returns_BookRootCommentDtoWithRequestedId(string id)
        {
            var expectedEntity = new BookRootComment()
            {
                Id = id
            };
            var expectedDto = new RootDto()
            {
                Id = id
            };

            _mockRootRepository.Setup(s => s.FindByIdAsync(id)).ReturnsAsync(expectedEntity);
            _mockMapper.Setup(s => s.MapAsync(expectedEntity)).ReturnsAsync(new RootDto()
            {
                Id = expectedDto.Id
            });

            var result = await _bookRootCommentService.GetById(id);

            result.Should().BeOfType <RootDto>();
            result.Id.Should().Be(id);
        }
Exemplo n.º 16
0
 public void Update(RootDto dto)
 {
     listDal.Update(dto.BusinessItemDtos);
 }
Exemplo n.º 17
0
 public void Update(RootDto dto)
 {
 }