public void SaveSiteOrder(OrderSite orderSite) { using (var context = new FSWContext()) { if (orderSite.id == 0) { context.OrderSites.Add(orderSite); } else { OrderSite dbEntry = context.OrderSites.Find(orderSite.id); if (dbEntry != null) { dbEntry.Name = orderSite.Name; dbEntry.Surname = orderSite.Surname; dbEntry.Phone = orderSite.Phone; dbEntry.Email = orderSite.Email; dbEntry.TariffPlan = orderSite.TariffPlan; dbEntry.Notes = orderSite.Notes; dbEntry.isCheked = orderSite.isCheked; } } context.SaveChanges(); } }
public AskQuestion FindQuestion(int Id) { using (var context = new FSWContext()) { var dbEntry = context.AskQuestions.Find(Id); return(dbEntry); } }
public Gallery FindGallery(int Id) { using (var context = new FSWContext()) { var dbEntry = context.Galleries.Find(Id); return(dbEntry); } }
public Feedback FindFeedback(int Id) { using (var context = new FSWContext()) { var dbEntry = context.Feedbacks.Find(Id); return(dbEntry); } }
public OrderSite FindOrder(int Id) { using (var context = new FSWContext()) { var dbEntry = context.OrderSites.Find(Id); return(dbEntry); } }
public void DeleteGallery(int Id) { using (var context = new FSWContext()) { Gallery dbEntry = context.Galleries.Find(Id); if (dbEntry != null) { context.Galleries.Remove(dbEntry); context.SaveChanges(); } } }
public void DeleteFeedback(int Id) { using (var context = new FSWContext()) { Feedback dbEntry = context.Feedbacks.Find(Id); if (dbEntry != null) { context.Feedbacks.Remove(dbEntry); context.SaveChanges(); } } }
public void SaveGallery(Gallery gallery) { using (var context = new FSWContext()) { if (gallery.id == 0) { gallery.FileName = "/Content/img/gallery/" + gallery.FileName; context.Galleries.Add(gallery); } else { Gallery dbEntry = context.Galleries.Find(gallery.id); if (dbEntry != null) { dbEntry.Desciption = gallery.Desciption; dbEntry.FileName = gallery.FileName; } } context.SaveChanges(); } }
public bool Validation(Feedback feedback) { feedback.CreatedTime = DateTime.Now; using (var context = new FSWContext()) { // .AsEnumerable() or SqlFunctions.StringConvert(variable); var validation = context.Feedbacks .AsEnumerable() .Where( v => v.Email == feedback.Email && v.CreatedTime.Date == feedback.CreatedTime.Date); if (validation.FirstOrDefault() == null) { return(true); } else { return(false); } } }
public void SaveQuestion(AskQuestion askQuestion) { using (var context = new FSWContext()) { if (askQuestion.id == 0) { context.AskQuestions.Add(askQuestion); } else { AskQuestion dbEntry = context.AskQuestions.Find(askQuestion.id); if (dbEntry != null) { dbEntry.Name = askQuestion.Name; dbEntry.Email = askQuestion.Email; dbEntry.TextMessage = askQuestion.TextMessage; dbEntry.isCheked = askQuestion.isCheked; } } context.SaveChanges(); } }
public void SaveFeedback(Feedback feedback) { using (var context = new FSWContext()) { if (feedback.id == 0) { context.Feedbacks.Add(feedback); } else { Feedback dbEntry = context.Feedbacks.Find(feedback.id); if (dbEntry != null) { dbEntry.Name = feedback.Name; dbEntry.Email = feedback.Email; dbEntry.Review = feedback.Review; dbEntry.isCheked = feedback.isCheked; } } context.SaveChanges(); } }