示例#1
0
 public void signup(User entity)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Entry(entity.Role).State = EntityState.Unchanged;
         context.Add(entity);
         context.SaveChanges();
     }
 }
 public Country AddCountry(Country country)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Add(country);
         context.SaveChanges();
     }
     return(country);
 }
 public Province AddProvince(Province province)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Entry(province.Country).State = EntityState.Unchanged;
         context.Add(province);
         context.SaveChanges();
     }
     return(province);
 }
 public City AddCity(City city)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Entry(city.Province).State = EntityState.Unchanged;
         context.Add(city);
         context.SaveChanges();
     }
     return(city);
 }