Esempio n. 1
0
        public async Task AddAdminAsync(Admin a)
        {
            try
            {
                var e = Mapper.MapAdmin(a);

                _context.Add(e);
                await _context.SaveChangesAsync();
            }
            catch
            {
                throw new InvalidOperationException("There is already an existed username, phone, or email");
            }
        }
Esempio n. 2
0
 public async Task AddMemberAsync(Member m)
 {
     try
     {
         var e = Mapper.MapMember(m);
         _context.Add(e);
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateException ex)
     {
         throw new InvalidOperationException("There is already an existed username, phone, or email" + ex);
     }
 }