Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("GroupID,Title,Name")] PageGroups pageGroups)
        {
            if (id != pageGroups.GroupID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _groupRepository.UpdateGroup(pageGroups);
                    await _groupRepository.Save();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PageGroupsExists(pageGroups.GroupID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pageGroups));
        }
Exemplo n.º 2
0
        public IActionResult Edit(int id, [Bind("GroupID,GroupTitle")] PageGroups pageGroups)
        {
            if (id != pageGroups.GroupID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.PageGroup.UpdateGroup(pageGroups);
                    db.PageGroup.Save();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PageGroupsExists(pageGroups.GroupID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pageGroups));
        }
Exemplo n.º 3
0
 public IActionResult Create([Bind("GroupID,GroupTitle")] PageGroups pageGroups)
 {
     if (ModelState.IsValid)
     {
         db.PageGroup.InsertGroup(pageGroups);
         db.PageGroup.Save();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(pageGroups));
 }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("GroupID,Title,Name")] PageGroups pageGroups)
        {
            if (ModelState.IsValid)
            {
                _groupRepository.InsertGroup(pageGroups);
                await _groupRepository.Save();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pageGroups));
        }
Exemplo n.º 5
0
 public bool DeleteGroup(PageGroups pageGroups)
 {
     try
     {
         db.Entry(pageGroups).State = EntityState.Deleted;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 6
0
 public bool UpdateGroup(PageGroups pageGroups)
 {
     try
     {
         db.Entry(pageGroups).State = EntityState.Modified;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 7
0
 public bool InsertGroup(PageGroups pageGroups)
 {
     try
     {
         db.PageGroups.Add(pageGroups);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 8
0
 public bool InsertGroup(PageGroups groups)
 {
     try
     {
         _db.Add(groups);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 9
0
 public bool DeleteGroup(PageGroups groups)
 {
     try
     {
         _db.Remove(groups);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 10
0
 public bool UpdateGroup(PageGroups groups)
 {
     try
     {
         _db.Update(groups);
         return(true);
     }
     catch
     {
         return(false);
     }
 }