public ActionResult RateMeal(int mealId, float rating) { try { Data.DTOs.LoginDto emp = UserSession.GetUser(); Data.Entities.Meals.RateMeal(emp.EmployeeId, mealId, rating); float newrate = Data.Entities.Meals.GetAverageRate(mealId); return(Json(new { success = true, newRating = newrate })); } catch (Exception e) { return(RedirectToAction("Error", "Login")); } }
public ActionResult CommentDelivery(int requestId, string comment) { try { if (String.IsNullOrEmpty(comment)) { return(Json(new { success = false, message = "incorrect parameters" })); } Data.DTOs.LoginDto emp = UserSession.GetUser(); Data.Entities.Meals.CommentRequest(requestId, emp.EmployeeId, comment); return(Json(new { success = true })); } catch (Exception e) { return(RedirectToAction("Error", "Login")); } }