public ActionResult Create(RW_Reviews rw_reviews) { bool wasNotApproved = false; if (ModelState.IsValid) { using (db) { using (TransactionScope tr = new TransactionScope()) { wasNotApproved = Extensions.ExtensionHelper.NotApproved(rw_reviews.RW_Comentario); if (wasNotApproved) { rw_reviews.ST_Id = 7; } db.RW_Reviews.Add(rw_reviews); var solicitud = db.SS_SolicitudServicio.Find(rw_reviews.SS_Id); solicitud.ST_Id = 5; db.Entry(solicitud).State = EntityState.Modified; db.SaveChanges(); tr.Complete(); } if (!wasNotApproved) return RedirectToAction("Index", "Home"); else return RedirectToAction("ReviewNotApproved", "Review"); } } ViewBag.SS_Id = new SelectList(db.SS_SolicitudServicio, "SS_Id", "SS_Id", rw_reviews.SS_Id); return View(rw_reviews); }
public ActionResult Create(int id = 0) { RW_Reviews rw_reviews = new RW_Reviews(); rw_reviews.RW_Fecha = System.DateTime.Now; rw_reviews.RW_Id = 0; rw_reviews.SS_Id = id; rw_reviews.RW_Rate = 0; return View(rw_reviews); }
public ActionResult Edit(RW_Reviews rw_reviews) { if (ModelState.IsValid) { db.Entry(rw_reviews).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SS_Id = new SelectList(db.SS_SolicitudServicio, "SS_Id", "SS_Id", rw_reviews.SS_Id); return View(rw_reviews); }