예제 #1
0
 public bool AddUser(User user)
 {
     try
     {
         db.Users.Add(user);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #2
0
 public bool AddTypeBlog(TypeBlog typeBlog)
 {
     try
     {
         db.TypeBlogs.Add(typeBlog);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #3
0
 public bool AddCustomer(WebServiceAssigment2.Models.DataModels.Customer customer)
 {
     try
     {
         db.Customers.Add(customer);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #4
0
 public bool AddBlog(Blog bl, string userName, string passWord)
 {
     try
     {
         var obj = db.Users.Where(a => a.UserName.Equals(userName) &&
                                  a.Password.Equals(passWord)).FirstOrDefault();
         if (obj != null)
         {
             db.Blogs.Add(bl);
             db.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
예제 #5
0
 public bool AddComment(Comments comments, string email, string passWord)
 {
     try
     {
         var obj = db.Customers.Where(a => a.Email.Equals(email) &&
                                      a.Password.Equals(passWord)).FirstOrDefault();
         if (obj != null)
         {
             db.Comments.Add(comments);
             db.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }