public Task <Result <Guid> > Add(CreateRelativeModel model)
        => Result <Guid> .TryAsync(async() =>
        {
            var relative = new Relatives
            {
                Id           = Guid.NewGuid(),
                UserId       = generalDataService.User.Id,
                Firstname    = model.Firstname,
                Lastname     = model.Lastname,
                DateOfBirth  = model.DateOfBirth,
                RelationType = model.RelationType,
                SinNumber    = model.SinNumber
            };

            _repository.Add(relative);
            await _repository.CommitAsync();
            return(Result <Guid> .Successful(relative.Id));
        });
Beispiel #2
0
        public async Task <Result <Guid> > AdvanceCreate([FromQuery] Guid surveyId, CreateRelativeModel model)
        {
            var userId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "Id").Value);

            var result = await _membershipServiceApi.MembershipRelativeApiService.Add(model);

            var usersurvey = await _userSurveyBiz.GetByUserIdAndSurveyId(userId, surveyId);

            var userRelativeSurvey = new UserRelativeSurvey
            {
                Id           = Guid.NewGuid(),
                UserSurveyId = usersurvey.Data.Id,
                RelativeId   = result.Data
            };

            _repository.Add(userRelativeSurvey);
            await _repository.CommitAsync();

            return(result);
        }
 public async Task <Result <Guid> > Add(CreateRelativeModel model)
 => await _relativeBiz.Add(model);
Beispiel #4
0
 public async Task <Result <Guid> > Add(CreateRelativeModel model)
 => await _membershipServiceApi.MembershipRelativeApiService.Add(model);