Ejemplo n.º 1
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));
     }
 }
Ejemplo n.º 2
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));
            }
        }
        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));
            }
        }
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            using (ApplicationDbContextcs db = new ApplicationDbContextcs())
            {
                var convBlogItem = await db.ConvBlogItem.FindAsync(id);

                db.ConvBlogItem.Remove(convBlogItem);
                await db.SaveChangesAsync();

                return(RedirectToAction("Blog", "App"));
            }
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            using (ApplicationDbContextcs db = new ApplicationDbContextcs())
            {
                var userAcccount = await db.userAccount.FindAsync(id);

                db.userAccount.Remove(userAcccount);
                await db.SaveChangesAsync();

                string url = @"../../App/Settings";
                return(Redirect(url));
            }
        }
        public async Task <IActionResult> Create([Bind("ConvBlogItemID,ConvName,ConvCreatorName")] ConvBlogItem convBlogItem)
        {
            using (ApplicationDbContextcs db = new ApplicationDbContextcs())
            {
                if (ModelState.IsValid)
                {
                    db.Add(convBlogItem);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Blog", "App"));
                }
                return(View(convBlogItem));
            }
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("UId,FirstName,LastName,Email,UserName,Password,ConfirmPassword,UPriv")] UserAcccount userAcccount)
        {
            using (ApplicationDbContextcs db = new ApplicationDbContextcs())
            {
                if (ModelState.IsValid)
                {
                    db.Add(userAcccount);
                    await db.SaveChangesAsync();

                    string url = @"../../App/Settings";
                    return(Redirect(url));
                }
                return(View(userAcccount));
            }
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> Create([Bind("BlogItemID,ConvID,UID,Subject,Message,RelatedID")] BlogItem blogItem)
        {
            using (ApplicationDbContextcs db = new ApplicationDbContextcs())
            {
                if (ModelState.IsValid)
                {
                    blogItem.Date = DateTime.Now;
                    db.Add(blogItem);
                    await db.SaveChangesAsync();

                    string url = @"../../ConvBlogItems/Conversation/" + blogItem.ConvID;
                    return(Redirect(url));
                }
                return(View(blogItem));
            }
        }