コード例 #1
0
        public async Task <IActionResult> Create([Bind("CustomId,CustomName,CustomDetails,CustomLocation,CauseType,DonateLink,Username")] CustomCauses customCauses)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customCauses);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customCauses));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("CtypeName")] CharityType charityType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(charityType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(charityType));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("PostId,PostDetails,PostDate,PostTitle,UserEmail")] Posts posts)
        {
            if (ModelState.IsValid)
            {
                _context.Add(posts);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(posts));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("DisasterId,DisasterName,DisasterDetails,DisasterLocation,DisasterLink,Urgency,DtypeName")] Disaster disaster)
        {
            if (ModelState.IsValid)
            {
                _context.Add(disaster);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DtypeName"] = new SelectList(_context.DisasterType, "DtypeName", "DtypeName", disaster.DtypeName);
            return(View(disaster));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("CharityId,CharityDetails,CharityName,CharityOrganization,CharityLocation,CharityLink,CtypeName")] Charity charity)
        {
            if (ModelState.IsValid)
            {
                _context.Add(charity);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CtypeName"] = new SelectList(_context.CharityType, "CtypeName", "CtypeName", charity.CtypeName);
            return(View(charity));
        }