Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("BlogItemID,ConvID,Subject,Message")] BlogItem blogItem)
        {
            using (ApplicationDbContextcs db = new ApplicationDbContextcs())
            {
                if (id != blogItem.BlogItemID)
                {
                    return(NotFound());
                }

                if (ModelState.IsValid)
                {
                    try
                    {
                        db.Update(blogItem);
                        await db.SaveChangesAsync();
                    }
                    catch (DbUpdateConcurrencyException)
                    {
                        if (!BlogItemExists(blogItem.BlogItemID))
                        {
                            return(NotFound());
                        }
                        else
                        {
                            throw;
                        }
                    }
                    string url = @"../../ConvBlogItems/Conversation/" + blogItem.ConvID;
                    return(Redirect(url));
                }
                ViewData["ConvID"] = blogItem.ConvID;
                return(View(blogItem));
            }
        }
Exemplo n.º 2
0
 public async Task <IActionResult> Edit(int id, [Bind("UId,FirstName,LastName,Email,UserName,Password,ConfirmPassword,UPriv")] UserAcccount userAcccount)
 {
     if (id != userAcccount.UId)
     {
         return(NotFound());
     }
     using (ApplicationDbContextcs db = new ApplicationDbContextcs())
     {
         if (ModelState.IsValid)
         {
             try
             {
                 db.Update(userAcccount);
                 await db.SaveChangesAsync();
             }
             catch (DbUpdateConcurrencyException)
             {
                 if (!UserAcccountExists(userAcccount.UId))
                 {
                     return(NotFound());
                 }
                 else
                 {
                     throw;
                 }
             }
             string url = @"../../App/Settings";
             return(Redirect(url));
         }
         return(View(userAcccount));
     }
 }
        public async Task <IActionResult> Edit(int id, [Bind("ConvBlogItemID,ConvName,ConvCreatorName")] ConvBlogItem convBlogItem)
        {
            using (ApplicationDbContextcs db = new ApplicationDbContextcs())
            {
                if (id != convBlogItem.ConvBlogItemID)
                {
                    return(NotFound());
                }

                if (ModelState.IsValid)
                {
                    try
                    {
                        db.Update(convBlogItem);
                        await db.SaveChangesAsync();
                    }
                    catch (DbUpdateConcurrencyException)
                    {
                        if (!ConvBlogItemExists(convBlogItem.ConvBlogItemID))
                        {
                            return(NotFound());
                        }
                        else
                        {
                            throw;
                        }
                    }
                    return(RedirectToAction("Blog", "App"));
                }
                return(View(convBlogItem));
            }
        }