コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("DisasterId,DisasterName,DisasterDetails,DisasterLocation,DisasterLink,Urgency,DtypeName")] Disaster disaster)
        {
            if (id != disaster.DisasterId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(disaster);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DisasterExists(disaster.DisasterId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DtypeName"] = new SelectList(_context.DisasterType, "DtypeName", "DtypeName", disaster.DtypeName);
            return(View(disaster));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("CustomId,CustomName,CustomDetails,CustomLocation,CauseType,DonateLink,Username")] CustomCauses customCauses)
        {
            if (id != customCauses.CustomId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customCauses);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomCausesExists(customCauses.CustomId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customCauses));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(string id, [Bind("CtypeName")] CharityType charityType)
        {
            if (id != charityType.CtypeName)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(charityType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CharityTypeExists(charityType.CtypeName))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(charityType));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("CharityId,CharityDetails,CharityName,CharityOrganization,CharityLocation,CharityLink,CtypeName")] Charity charity)
        {
            if (id != charity.CharityId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(charity);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CharityExists(charity.CharityId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CtypeName"] = new SelectList(_context.CharityType, "CtypeName", "CtypeName", charity.CtypeName);
            return(View(charity));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("PostId,PostDetails,PostDate,PostTitle,UserEmail")] Posts posts)
        {
            if (id != posts.PostId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(posts);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PostsExists(posts.PostId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(posts));
        }