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 AddIssue(Issues issue) { using (LearnContext lc = new LearnContext()) { lc.Issues.Add(issue); lc.SaveChanges(); } }
public void AddEarnings(Earning earning) { using (LearnContext lc = new LearnContext()) { lc.Earnings.Add(earning); lc.SaveChanges(); } }
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 DeleteIssue(int Id) { using (LearnContext lc = new LearnContext()) { Issues issues = lc.Issues.Find(Id); lc.Issues.Remove(issues); 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 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 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 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); } }
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 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 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 void DeleteTeacher(User user) { using (LearnContext lc = new LearnContext()) { try { lc.Entry(user.AccountStatus).State = EntityState.Modified; lc.Entry(user).State = EntityState.Modified; lc.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { ex.Entries.Single().Reload(); } } }
public void UpdateRequest(Request request) { using (LearnContext lc = new LearnContext()) { try { lc.Entry(request.RequestStatus).State = EntityState.Modified; lc.Entry(request).State = EntityState.Modified; lc.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { ex.Entries.Single().Reload(); } } }
public void ModifyUser(User user) { using (LearnContext lc = new LearnContext()) { User u = lc.Users.Find(user.Id); if (user.Password != null) { u.Password = user.Password; } if (user.FirstName != null) { u.FirstName = user.FirstName; } if (user.FirstName != null) { u.LastName = user.LastName; } u.AccountStatusID = user.AccountStatusID; lc.SaveChanges(); } }