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; } } }
public void AddEarnings(Earning earning) { using (LearnContext lc = new LearnContext()) { lc.Earnings.Add(earning); lc.SaveChanges(); } }
public void AddIssue(Issues issue) { using (LearnContext lc = new LearnContext()) { lc.Issues.Add(issue); lc.SaveChanges(); } }
public List <ProfileStatus> GetProfileStatuses() { using (LearnContext lc = new LearnContext()) { return((from p in lc.ProfileStatus select p ).ToList()); } }
public void DeleteIssue(int Id) { using (LearnContext lc = new LearnContext()) { Issues issues = lc.Issues.Find(Id); lc.Issues.Remove(issues); lc.SaveChanges(); } }
public Category SearchCategory(string Data) { using (LearnContext lc = new LearnContext()) { return((from c in lc.Categories where Data == c.Name select c).FirstOrDefault()); } }
public List <Subcategory> GetSubcategories() { using (LearnContext lc = new LearnContext()) { return((from c in lc.Subcategories select c ).ToList()); } }
public Subcategory GetSubcategory(int Id) { using (LearnContext lc = new LearnContext()) { return((from s in lc.Subcategories where s.Id == Id select s).FirstOrDefault()); } }
public Role GetRole(int id) { using (LearnContext lc = new LearnContext()) { return((from r in lc.Roles where r.Id == id select r).FirstOrDefault()); } }
public AccountStatus GetAccountStatus(int Id) { using (LearnContext lc = new LearnContext()) { return((from s in lc.AccountStatuses where s.Id == Id select s).FirstOrDefault()); } }
public List <Earning> GetAllEarnings(int Id) { using (LearnContext lc = new LearnContext()) { return((from e in lc.Earnings where e.TeacherId == Id select e).ToList()); } }
public Subcategory SearchSubCategory(string Data) { using (LearnContext lc = new LearnContext()) { return((from sc in lc.Subcategories where Data == sc.Name select sc).FirstOrDefault()); } }
public List <Country> GetCountries() { using (LearnContext lc = new LearnContext()) { return((from c in lc.Countries select c ).ToList()); } }
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()); } }
public Category GetCategory(int Id) { using (LearnContext lc = new LearnContext()) { return((from c in lc.Categories where c.Id == Id select c).FirstOrDefault()); } }
public void AddReview(Review review) { using (LearnContext lc = new LearnContext()) { //lc.Entry(review.Request).State = EntityState.Unchanged; lc.Reviews.Add(review); lc.SaveChanges(); } }
public void DeleteCategory(int Id) { using (LearnContext lc = new LearnContext()) { Category category = lc.Categories.Find(Id); lc.Categories.Remove(category); lc.SaveChanges(); } }
public Country GetCountry(int id) { using (LearnContext lc = new LearnContext()) { return((from c in lc.Countries where c.Id == id select c ).FirstOrDefault()); } }
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()); } }
public User GetUserId(int Id) { using (LearnContext lc = new LearnContext()) { return((from u in lc.Users where (u.Id == Id) select u) .FirstOrDefault()); } }
public PaymentStatus GetPaymentStatus(int id) { using (LearnContext lc = new LearnContext()) { return((from c in lc.PaymentStatuses where c.Id == id select c ).FirstOrDefault()); } }
public Issues GetIssue(int id) { using (LearnContext lc = new LearnContext()) { return((from i in lc.Issues where i.Id == id select i ).FirstOrDefault()); } }
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(); } }
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(); } }
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()); } }
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(); } }
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()); } }
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(); } }
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(); } }
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); } }