Exemplo n.º 1
0
 public void EditProfile(Profile profile)
 {
     using (LearnContext lc = new LearnContext())
     {
         try
         {
             Profile profile1 = lc.Profiles.Find(profile.Id);
             profile1.Description = profile.Description;
             profile1.Image       = profile.Image;
             profile1.PackagePlan.CostPer3Days = profile.PackagePlan.CostPer3Days;
             profile1.PackagePlan.CostPerDay   = profile.PackagePlan.CostPerDay;
             profile1.PackagePlan.CostPerHour  = profile.PackagePlan.CostPerHour;
             profile1.Name          = profile.Name;
             profile1.CategoryId    = profile.CategoryId;
             profile1.SubcategoryId = profile.SubcategoryId;
             lc.Entry(profile1.PackagePlan).State = EntityState.Modified;
             lc.Entry(profile1).State             = EntityState.Modified;
             lc.SaveChanges();
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
Exemplo n.º 2
0
 public void AddEarnings(Earning earning)
 {
     using (LearnContext lc = new LearnContext())
     {
         lc.Earnings.Add(earning);
         lc.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void AddIssue(Issues issue)
 {
     using (LearnContext lc = new LearnContext())
     {
         lc.Issues.Add(issue);
         lc.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public List <ProfileStatus> GetProfileStatuses()
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from p in lc.ProfileStatus
                 select p
                 ).ToList());
     }
 }
Exemplo n.º 5
0
 public void DeleteIssue(int Id)
 {
     using (LearnContext lc = new LearnContext())
     {
         Issues issues = lc.Issues.Find(Id);
         lc.Issues.Remove(issues);
         lc.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public Category SearchCategory(string Data)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from c in lc.Categories
                 where Data == c.Name
                 select c).FirstOrDefault());
     }
 }
Exemplo n.º 7
0
 public List <Subcategory> GetSubcategories()
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from c in lc.Subcategories
                 select c
                 ).ToList());
     }
 }
Exemplo n.º 8
0
 public Subcategory GetSubcategory(int Id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from s in lc.Subcategories
                 where s.Id == Id
                 select s).FirstOrDefault());
     }
 }
Exemplo n.º 9
0
 public Role GetRole(int id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from r in lc.Roles
                 where r.Id == id
                 select r).FirstOrDefault());
     }
 }
Exemplo n.º 10
0
 public AccountStatus GetAccountStatus(int Id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from s in lc.AccountStatuses
                 where s.Id == Id
                 select s).FirstOrDefault());
     }
 }
Exemplo n.º 11
0
 public List <Earning> GetAllEarnings(int Id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from e in lc.Earnings
                 where e.TeacherId == Id
                 select e).ToList());
     }
 }
Exemplo n.º 12
0
 public Subcategory SearchSubCategory(string Data)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from sc in lc.Subcategories
                 where Data == sc.Name
                 select sc).FirstOrDefault());
     }
 }
Exemplo n.º 13
0
 public List <Country> GetCountries()
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from c in lc.Countries
                 select c
                 ).ToList());
     }
 }
Exemplo n.º 14
0
 public List <User> SearchTeacher(string Data)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from t in lc.Users
                 where Data == t.FirstName || Data == t.LastName || Data == t.Email
                 select t).ToList());
     }
 }
Exemplo n.º 15
0
 public Category GetCategory(int Id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from c in lc.Categories
                 where c.Id == Id
                 select c).FirstOrDefault());
     }
 }
Exemplo n.º 16
0
 public void AddReview(Review review)
 {
     using (LearnContext lc = new LearnContext())
     {
         //lc.Entry(review.Request).State = EntityState.Unchanged;
         lc.Reviews.Add(review);
         lc.SaveChanges();
     }
 }
Exemplo n.º 17
0
 public void DeleteCategory(int Id)
 {
     using (LearnContext lc = new LearnContext())
     {
         Category category = lc.Categories.Find(Id);
         lc.Categories.Remove(category);
         lc.SaveChanges();
     }
 }
Exemplo n.º 18
0
 public Country GetCountry(int id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from c in lc.Countries
                 where c.Id == id
                 select c
                 ).FirstOrDefault());
     }
 }
Exemplo n.º 19
0
 public List <Subcategory> GetSubCategories(int id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from c in lc.Subcategories
                 where c.Category.Id == id
                 select c
                 ).ToList());
     }
 }
Exemplo n.º 20
0
 public User GetUserId(int Id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from u in lc.Users
                 where (u.Id == Id)
                 select u)
                .FirstOrDefault());
     }
 }
Exemplo n.º 21
0
 public PaymentStatus GetPaymentStatus(int id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from c in lc.PaymentStatuses
                 where c.Id == id
                 select c
                 ).FirstOrDefault());
     }
 }
Exemplo n.º 22
0
 public Issues GetIssue(int id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from i in lc.Issues
                 where i.Id == id
                 select i
                 ).FirstOrDefault());
     }
 }
Exemplo n.º 23
0
 public void AddProfile(Profile profile)
 {
     using (LearnContext lc = new LearnContext())
     {
         lc.Entry(profile.Teacher).State       = EntityState.Unchanged;
         lc.Entry(profile.ProfileStatus).State = EntityState.Unchanged;
         lc.Profiles.Add(profile);
         lc.SaveChanges();
     }
 }
Exemplo n.º 24
0
 public void AddProfilePicture(User user)
 {
     using (LearnContext lc = new LearnContext())
     {
         User u = lc.Users.Find(user.Id);
         u.Image           = user.Image;
         lc.Entry(u).State = EntityState.Modified;
         lc.SaveChanges();
     }
 }
Exemplo n.º 25
0
 public List <RequestMessage> GetRequestMessageList(int Id)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from rm in lc.RequestMessages
                 where rm.Request.Id == Id
                 select rm)
                .ToList());
     }
 }
Exemplo n.º 26
0
 public void AddMessage(RequestMessage requestMessage)
 {
     using (LearnContext lc = new LearnContext())
     {
         lc.Entry(requestMessage.Sender).State   = EntityState.Unchanged;
         lc.Entry(requestMessage.Reciever).State = EntityState.Unchanged;
         lc.Entry(requestMessage.Request).State  = EntityState.Unchanged;
         lc.RequestMessages.Add(requestMessage);
         lc.SaveChanges();
     }
 }
Exemplo n.º 27
0
 public Profile GetProfile(string Email)
 {
     using (LearnContext lc = new LearnContext())
     {
         return((from p in lc.Profiles
                 .Include(m => m.PackagePlan)
                 .Include(m => m.ProfileStatus)
                 where p.Teacher.Email == Email
                 select p).FirstOrDefault());
     }
 }
Exemplo n.º 28
0
 public void AddRequest(Request request)
 {
     using (LearnContext lc = new LearnContext())
     {
         lc.Entry(request.RequestStatus).State = EntityState.Unchanged;
         lc.Entry(request.Student).State       = EntityState.Unchanged;
         lc.Entry(request.Teacher).State       = EntityState.Unchanged;
         lc.Requests.Add(request);
         lc.SaveChanges();
     }
 }
Exemplo n.º 29
0
 public void AddUser(User user)
 {
     using (LearnContext lc = new LearnContext())
     {
         lc.Entry(user.Country).State       = EntityState.Unchanged;
         lc.Entry(user.Role).State          = EntityState.Unchanged;
         lc.Entry(user.AccountStatus).State = EntityState.Unchanged;
         lc.Users.Add(user);
         lc.SaveChanges();
     }
 }
Exemplo n.º 30
0
 public Category EditCategory(Category category)
 {
     using (LearnContext lc = new LearnContext())
     {
         Category c = lc.Categories.Find(category.Id);
         c.Name  = category.Name;
         c.Image = category.Image;
         lc.SaveChanges();
         return(c);
     }
 }