public ActionResult GetMYOrders() { using (CMSProjectEntities db = new CMSProjectEntities()) { var username = System.Web.HttpContext.Current.User.Identity.Name; CMSProject.Models.DB.User user = db.Users.Where(o => o.Username.Equals(username)).FirstOrDefault(); DataManager DM = new DataManager(); List <OrdersView> orders = new List <OrdersView>(); orders = DM.GetMyOrders(user.UserID); return(Json(new { data = orders }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Feedback(FeedbackView FV) { using (CMSProjectEntities db = new CMSProjectEntities()) { CMSProject.Models.DB.Feedback FB = new Feedback(); FB.Description = FV.Description; UserManager UM = new UserManager(); var username = System.Web.HttpContext.Current.User.Identity.Name; CMSProject.Models.DB.User user = db.Users.Where(o => o.Username.Equals(username)).FirstOrDefault(); FB.CustomerID = db.CustomerUsers.Where(o => o.UserID.Equals(user.UserID)).FirstOrDefault().CustomerID; db.Feedbacks.Add(FB); db.SaveChanges(); } return(RedirectToAction("Index", "Home")); }