예제 #1
0
        public async Task <ICollection <ActiveFuneralResponse> > GetPaidFunerals(int profileId)
        {
            var Funerals     = new List <ActiveFuneralResponse>();
            var transactions = await _context.Transactions.Where(f => f.Contribution == true && f.CreatedBy == profileId).ToListAsync();


            foreach (var item in transactions)
            {
                var funeral = await GetFuneral(item.FuneralId);

                if (funeral != null)
                {
                    foreach (var i in funeral.ResponseData)
                    {
                        var funeralDetail = new ActiveFuneralResponse();


                        funeralDetail.DeceasedFullName       = _context.Profile.Find(i.DeceasedsProfileNumber).Name + " " + _context.Profile.Find(i.DeceasedsProfileNumber).Surname;
                        funeralDetail.DeceasedsProfileNumber = i.DeceasedsProfileNumber;
                        funeralDetail.Created = i.Created;
                        Funerals.Add(funeralDetail);
                    }
                }
            }

            return(Funerals);
        }
예제 #2
0
        private async Task <ResponseModel <ActiveFuneralResponse> > GetActiveFuneralResponse(List <Funeral> dbResponse)
        {
            List <ActiveFuneralResponse>          _response = new List <ActiveFuneralResponse>();
            ResponseModel <ActiveFuneralResponse> response  = InitializeActiveFuneral();

            foreach (var item in dbResponse)
            {
                var deceasedProfile = await _context.Profile.FindAsync(item.DeceasedsProfileNumber);

                ActiveFuneralResponse funeralRecord = new ActiveFuneralResponse
                {
                    FuneralId = item.FuneralId,
                    DeceasedsProfileNumber = item.DeceasedsProfileNumber,
                    AddressForFuneral      = item.AddressForFuneral,
                    Comment               = item.Comment,
                    DeceasedFullName      = deceasedProfile.Name + " " + deceasedProfile.Surname,
                    DeceasedProfileStatus = (await _context.Statuses.FindAsync(deceasedProfile.Status)).StatusDescription.ToString()
                };

                _response.Add(funeralRecord);
            }
            response = GetResponseList(response, _response);

            return(response);
        }
예제 #3
0
        private async Task <List <ActiveFuneralResponse> > GetFuneralDetails(Funeral funeral, bool contributed)
        {
            var response       = new List <ActiveFuneralResponse>();
            var funeralDetails = await GetFuneral(funeral.FuneralId);

            if (funeralDetails != null)
            {
                foreach (var i in funeralDetails.ResponseData)
                {
                    var activeFuneralResponse = new ActiveFuneralResponse();

                    var deceasedProfile = await _context.Profile.FindAsync(i.DeceasedsProfileNumber);

                    activeFuneralResponse.DeceasedFullName       = deceasedProfile.Name + " " + deceasedProfile.Surname;
                    activeFuneralResponse.DeceasedsProfileNumber = i.DeceasedsProfileNumber;
                    activeFuneralResponse.Created     = i.Created;
                    activeFuneralResponse.Contributed = contributed;
                    response.Add(activeFuneralResponse);
                }
            }

            return(response);
        }