Esempio n. 1
0
        void IGroupRepository.Delete(int id)
        {
            tGroup user = Find(id);

            if (user != null && user.IDGroup > 0)
            {
                context.tGroups.DeleteOnSubmit(user);
            }
            context.SubmitChanges();
        }
Esempio n. 2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            tGroup = await _context.tGroup.SingleOrDefaultAsync(m => m.group_id == id);

            if (tGroup == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Esempio n. 3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            tGroup = await _context.tGroup.FindAsync(id);

            if (tGroup != null)
            {
                _context.tGroup.Remove(tGroup);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 4
0
 public void InsertOrUpdate(tGroup user)
 {
     if (user.IDGroup == default(int))
     {
         // New entity
         context.tGroups.InsertOnSubmit(user);
     }
     else
     {
         // Existing entity
         tGroup userToUpdate = Find(user.IDGroup);
         if (userToUpdate != null && userToUpdate.IDGroup > 0)
         {
             userToUpdate.Name    = user.Name;
             userToUpdate.IDGroup = user.IDGroup;
         }
     }
     context.SubmitChanges();
 }