Exemplo n.º 1
0
 public ActionResult Details(string tag)
 {
     using (var ctx = new Entities())
     {
         RequirementsDetailsModel req = new RequirementsDetailsModel(ctx.GetRequirementDetails(tag, null).FirstOrDefault());
         RouteData.Values["title"] = req.Summary;
         return View("Rate", new RateTopicModel(req));
     }
 }
 public ActionResult Details(string tag)
 {
     using (var ctx = new Entities())
     {
         RequirementsDetailsModel model = new RequirementsDetailsModel(ctx.GetRequirementDetails(tag, null).FirstOrDefault());
         RouteData.Values["title"] = model.Summary;
         return View(model);
     }
 }
Exemplo n.º 3
0
 public RateTopicModel(RequirementsDetailsModel req)
 {
     this.Topic = req;
     this.Rating = new UserRatingModel(req.RevisionId);
 }
Exemplo n.º 4
0
        public ActionResult MarkAsDone(string tag)
        {
            using (var ctx = new Entities())
            {
                RequirementsDetailsModel model = new RequirementsDetailsModel(ctx.GetRequirementDetails(tag, null).FirstOrDefault());
                int cellID = RouteData.Values["cell"].GetCellID();

                int userID = Authentication.GetLoggedUser().UserID;
                int ret = ctx.SaveRequirement(RequirementTypes.MarkAsDone, cellID, model.RevisionId, userID, "História atendida", tag, model.Summary, model.Text, null);

                if (ret != 0)
                {
                    model = new RequirementsDetailsModel(ctx.GetRequirementDetails(tag, null).FirstOrDefault());
                    RequirementRevision rev = ctx.RequirementRevisions.FirstOrDefault(i => i.RevisionID == model.RevisionId);
                    rev.Published = true;

                    if (ctx.SaveChanges() != 0)
                    {
                        Success("História finalizada com sucesso!");
                        return RedirectToAction("Details", new { @tag = tag });
                    }
                }

                Error("Erro ao tentar finalizar a história!");
                return RedirectToAction("Details", new { @tag = tag });
            }
        }
Exemplo n.º 5
0
 public RateTopicModel(RequirementsDetailsModel req)
 {
     this.Topic  = req;
     this.Rating = new UserRatingModel(req.RevisionId);
 }