Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Name,Phone,District,Thana,Address,RecipientType,PreviewesHealthProblem,BoodGroup,RecentDrag,Others,Approved,RequestDate,Id,CreatedDate")] Request request)
        {
            if (ModelState.IsValid)
            {
                request.RequestDate = DateTime.Now;
                _context.Add(request);
                await _context.SaveChangesAsync();

                ViewBag.Msg = "We will notify you if any donor want's to donate!";
            }
            return(View());
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Name,Phone,District,Thana,Address,DonateType,PreviewesHealthProblem,BoodGroup,RecentDrag,Others,Approved,Id,CreatedDate")] DonorModel donorModel)
        {
            if (ModelState.IsValid)
            {
                var alreadyExists = _context.Donors.Where(a => a.Phone == donorModel.Phone).FirstOrDefault();
                if (alreadyExists != null)
                {
                    ViewBag.Msg = "You already a Donor. Thanks to be a Donor!";
                    return(View());
                }
                _context.Add(donorModel);
                await _context.SaveChangesAsync();

                //  return RedirectToAction(nameof(Index));
                ViewBag.Msg = "Congratulation!! and Thanks to be a Donor!";
            }
            return(View());
        }
Beispiel #3
0
        protected override async Task ProcessEvent(TransactionIntegrationEvent @event)
        {
            var transactionSource = GetTransactionSource(@event);

            if (transactionSource == null)
            {
                return;
            }

            AddDonation(transactionSource, @event);

            await _donorContext.SaveChangesAsync();
        }
        protected override async Task ProcessEvent(CharityEvent @event)
        {
            var existingCharity = _donorContext
                                  .Charities
                                  .SingleOrDefault(x => x.Identifier == @event.CharityIdentifier);

            if (existingCharity == null)
            {
                return;
            }

            existingCharity.IsDeleted = true;
            await _donorContext.SaveChangesAsync();
        }
Beispiel #5
0
        protected override async Task ProcessEvent(CharityEvent @event)
        {
            var exists = _donorContext
                         .Charities
                         .SingleOrDefault(x => x.Identifier == @event.CharityIdentifier);

            if (exists == null)
            {
                exists = new Charity()
                {
                    Identifier = @event.CharityIdentifier
                };
                _donorContext.Charities.Add(exists);
            }

            exists.CharityName = @event.CharityName;
            await _donorContext.SaveChangesAsync();
        }
Beispiel #6
0
        protected override async Task ProcessEvent(CharityEvent @event)
        {
            var exists = _donorContext
                         .Charities
                         .Any(x => x.Identifier == @event.CharityIdentifier);

            if (exists)
            {
                return;
            }

            var charity = new Charity
            {
                Identifier  = @event.CharityIdentifier,
                CharityName = @event.CharityName,
                UpdatedAt   = DateTime.UtcNow,
                UpdatedBy   = "IntegrationEvent"
            };

            _donorContext.Charities.Add(charity);

            await _donorContext.SaveChangesAsync();
        }