public async Task <IActionResult> Create([Bind("Id,Title,Content,AuthorName,DateCreated")] Article article)
        {
            if (ModelState.IsValid)
            {
                _context.Add(article);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(article));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,EventTitle,Description,Date,Location")] Event @event)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@event);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(@event));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("Id,DonationId,dateReleased,HIV,HepatitisB,HepatitisC,Syphilis,PCR,Doctor")] MedResult medResult)
        {
            if (ModelState.IsValid)
            {
                _context.Add(medResult);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DonationId"] = new SelectList(_context.Donations, "Id", "EGN", medResult.DonationId);
            return(View(medResult));
        }
        public async Task <IActionResult> Create([Bind("Id,EGN,dateDonated,Quantity,BloodGroupId,Receiver")] Donation donation)
        {
            if (ModelState.IsValid)
            {
                var EGNcheck = _context.RCTHUsers.FirstOrDefault(u => u.EGN == donation.EGN);
                donation.UserId = EGNcheck == null ? null : EGNcheck.Id;
                _context.Add(donation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BloodGroupId"] = new SelectList(_context.BloodGroups, "Id", "Name", donation.BloodGroupId);
            return(View(donation));
        }