public string GetFeedBack(FeedBackID model) { Feedback feedbackBase = db.Feedbacks.Where(c => c.id_customer == model.id_customer).FirstOrDefault(); if (feedbackBase != null) { string jsonBase = JsonConvert.SerializeObject(feedbackBase); return(jsonBase); } else { return("Нету отзыва"); } }
public string DeleteFavorite(FeedBackID model) { if (model != null) { Favorite favorite = db.Favorites.Where(c => c.id_customer == model.id_customer).ToList().FirstOrDefault(); Favorite favoriteDelete = db.Favorites.Find(favorite.id_favorite); db.Favorites.Remove(favoriteDelete); db.SaveChangesAsync(); return("Успешно"); } else { return("Провал"); } }
public string DeleteFeedBack(FeedBackID model) { if (model != null) { Feedback feedback = db.Feedbacks.Where(c => c.id_customer == model.id_customer).ToList().FirstOrDefault(); Feedback feedbackDelete = new Feedback(); if (feedback != null) { feedbackDelete = db.Feedbacks.Find(feedback.id_feedback); db.Feedbacks.Remove(feedbackDelete); db.SaveChangesAsync(); string jsonBase = JsonConvert.SerializeObject(feedbackDelete); return(jsonBase); } else { feedback = new Feedback(); feedback.id_feedback = 0; feedback.id_customer = 0; feedback.content = "default"; string jsonBase = JsonConvert.SerializeObject(feedback); return(jsonBase); } } else { Feedback feedback = new Feedback(); feedback.id_feedback = 0; feedback.id_customer = 0; feedback.content = "default"; string jsonBase = JsonConvert.SerializeObject(feedback); return(jsonBase); } }