Beispiel #1
0
 public void Delete(PizzzaAdmin deletedAdmin)
 {
     try
     {
         var adminItem = _context.PizzzaAdmin.FirstOrDefault(z => z.AdminId == deletedAdmin.AdminId);
         _context.PizzzaAdmin.Remove(adminItem);
         _context.SaveChanges();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Beispiel #2
0
 public void Put([FromBody] PizzzaAdmin updatedAdmin)
 {
     try
     {
         var updated = _context.PizzzaAdmin.FirstOrDefault(z => z.AdminId == updatedAdmin.AdminId);
         updated.Fname         = updatedAdmin.Fname;
         updated.Lname         = updatedAdmin.Lname;
         updated.Username      = updatedAdmin.Username;
         updated.AdminPassword = updatedAdmin.AdminPassword;
         _context.SaveChanges();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Beispiel #3
0
 public void Post([FromBody] PizzzaAdmin newAdmin)
 {
     try
     {
         PizzzaAdmin addAdminItem = new PizzzaAdmin
         {
             Fname         = newAdmin.Fname,
             Lname         = newAdmin.Lname,
             Username      = newAdmin.Username,
             AdminPassword = newAdmin.AdminPassword
         };
         _context.PizzzaAdmin.Add(addAdminItem);
         _context.SaveChanges();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }