Exemplo n.º 1
0
 public static void AddUser(User user)
 {
     using (DAContext ctx = new DAContext())
     {
         // check if user exists.
         if (ctx.Users.Where(x => x.Email == user.Email).Count() > 0)
         {
             throw new Exception("User Exists");
         }
         else
         {
             ctx.Users.Add(user);
             ctx.SaveChanges();
         }
     }
 }
Exemplo n.º 2
0
 public T Insert(T obj)
 {
     dbSet.Add(obj);
     db.SaveChanges();
     return(obj);
 }
 public void Add(UserProfileDb profile)
 {
     context.Profiles.Add(profile);
     context.SearchCriterias.Add(profile.SearchCriteria);
     context.SaveChanges();
 }