public ActionResult Send(int id) { RequestDB re = new RequestDB(); re.from = User.Identity.Name; re.to = id; request.Requests.Add(re); request.SaveChanges(); return(RedirectToAction("Detail", "Item", new { id = id })); }
public ActionResult Request([Bind(Include = "ID,ItemID,ItemType,OwnerID,RequestorID")] RequestedItem requestedItem) { if (ModelState.IsValid) { dbRequest.RequestedItems.Add(requestedItem); dbRequest.SaveChanges(); return(RedirectToAction("Index", "Collection")); } return(View(requestedItem)); }
/// <summary> /// Logs an entry in the request database detailing what the user searched for /// as well as their browser and ip address /// </summary> /// <param name="q">terms the user searched for</param> private void LogRequest(string q) { Request tempLog = new Request { SearchTerms = q, RequestedOn = DateTime.Now, UserBrowser = Request.UserAgent, UserAddress = Request.UserHostAddress }; db.Requests.Add(tempLog); db.SaveChanges(); }