示例#1
0
 public AdminModel GetAdmin(int adminId)
 {
     if (adminId == 0)
     {
         var admin = new AdminModel()
         {
             Email=""
         };
         return admin;
     }
     else
     {
         var admin = new AdminModel()
         {
             Email = "*****@*****.**",
             Firstname = "Ole",
             Lastname = "Olsen",
             Address = "Persveien 5",
             Zipcode = "0123",
             City = "Oslo",
             AdminId = 1
         };
         return admin;
     }
 }
示例#2
0
        public AdminModel GetAdmin(string email)
        {
            using (var db = new TankshopDbContext())
            {
                var adminId = db.Admins.FirstOrDefault(a => a.Email == email).AdminId;
                var dbPerson = GetPerson(email);
                var admin = new AdminModel()
                {
                    AdminId = adminId,
                    Email = dbPerson.Email,
                    Firstname = dbPerson.Firstname,
                    Lastname = dbPerson.Lastname,
                    Address = dbPerson.Address,
                    Zipcode = dbPerson.Zipcode,
                    City = dbPerson.City
                };

                return admin;
            }
        }