Esempio n. 1
0
 public ActionResult Edit(string tag)
 {
     using (var ctx = new Entities())
     {
         StoriesCreateModel model = new StoriesCreateModel(ctx.GetRequirementDetails(tag, null).FirstOrDefault());
         RouteData.Values["title"] = model.Summary;
         return View("Create", model);
     }
 }
 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);
     }
 }
 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));
     }
 }
Esempio n. 4
0
        public ActionResult Publish(string tag)
        {
            using (var ctx = new Entities())
            {
                StoriesDetailsModel model = new StoriesDetailsModel(ctx.GetRequirementDetails(tag, null).FirstOrDefault());
                int cellID = RouteData.Values["cell"].GetCellID();

                int userID = Authentication.GetLoggedUser().UserID;
                int ret = ctx.SaveRequirement(RequirementTypes.Publish, cellID, model.RevisionId, userID, "Publicação de história", tag, model.Summary, model.Text, null);

                if (ret != 0)
                {
                    model = new StoriesDetailsModel(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 publicada com sucesso!");
                        return RedirectToAction("Details", new { @tag = tag });
                    }
                }

                Error("Erro ao tentar publicar a história!");
                return RedirectToAction("Details", new { @tag = tag });
            }
        }
        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, "Requisito implementado", 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("Requisito finalizado com sucesso!");
                        return RedirectToAction("Details", new { @tag = tag });
                    }
                }

                Error("Erro ao tentar finalizar o requisito!");
                return RedirectToAction("Details", new { @tag = tag });
            }
        }