// GET: Articles/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } criteria article = db.criterias.Find(id); if (article == null) { return(HttpNotFound()); } ViewBag.ModuleID = id.Value; var comments = db.criteriaCommentss.Where(d => d.ModuleId.Equals(id.Value)).ToList(); ViewBag.Comments = comments; var ratings = db.criteriaCommentss.Where(d => d.ModuleId.Equals(id.Value)).ToList(); if (ratings.Count() > 0) { var ratingSum = ratings.Sum(d => d.Rating.Value); ViewBag.RatingSum = ratingSum; var ratingCount = ratings.Count(); ViewBag.RatingCount = ratingCount; } else { ViewBag.RatingSum = 0; ViewBag.RatingCount = 0; } return(View(article)); }
public ActionResult Edit(int id, FormCollection collection) { criteria criteria = new criteria(); HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:9080/pidev-web/"); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); //houni essta3mlt service GetProjectById HttpResponseMessage response = client.GetAsync("rest/criteria/" + id).Result; if (response.IsSuccessStatusCode) { criteria = response.Content.ReadAsAsync <criteria>().Result; UpdateModel(criteria, collection); // TODO: Add insert logic here HttpClient client2 = new HttpClient(); client2.BaseAddress = new Uri("http://localhost:9080/pidev-web/"); client2.PutAsJsonAsync <criteria>("rest/criteria", criteria).ContinueWith((postTask) => postTask.Result.IsSuccessStatusCode); return(RedirectToAction("Index")); } else { return(View()); } }
public ActionResult DeleteConfirmed(int id) { criteria article = db.criterias.Find(id); db.criterias.Remove(article); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "AutoId,Topic,Description,Active")] criteria criteria) { if (ModelState.IsValid) { db.Entry(criteria).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(criteria)); }
public ActionResult Create([Bind(Include = "AutoId,Topic,Description,Active, DateCreated")] criteria criteria) { if (ModelState.IsValid) { criteria.DateCreated = DateTime.Now; db.criterias.Add(criteria); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(criteria)); }
// GET: Articles/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } criteria article = db.criterias.Find(id); if (article == null) { return(HttpNotFound()); } return(View(article)); }
public ActionResult Edit(int id) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:9080/pidev-web/"); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.GetAsync("rest/criteria/" + id).Result; criteria project = new criteria(); if (response.IsSuccessStatusCode) { project = response.Content.ReadAsAsync <criteria>().Result; } else { ViewBag.project = "erreur"; } return(View(project)); }
ArtistSortRule.ReleaseDate => OrderByReleaseDate(criteria, SortDirection.Descending),