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 Create(StoriesCreateModel model)
        {
            if (ModelState.IsValid)
            {
                using (var ctx = new Entities())
                {
                    model.Tag = Utils.Tagify(model.Summary);
                    int cellID = RouteData.Values["cell"].GetCellID();

                    if (ctx.TagExists(RequirementTypes.Story, cellID, null, model.Tag))
                    {
                        Warning("Já existe uma história com este nome!");
                    }
                    else
                    {
                        int userID = Authentication.GetLoggedUser().UserID;
                        int ret = ctx.SaveRequirement(RequirementTypes.Story, cellID, null, userID, model.Message, model.Tag, model.Summary, model.Text, null);

                        if (ret != 0)
                        {
                            Success("História inserida com sucesso!");
                            return RedirectToRoute("Details", new { @cell = RouteData.Values["cell"], @controller = RouteData.Values["controller"], @tag = model.Tag, @action = "Details" });
                        }
                        else
                        {
                            Error("Erro ao tentar inserir a nova história!");
                        }
                    }
                }
            }
            else
            {
                Warning("Preencha o formulário corretamente!");
            }
            return View(model);
        }
 public ActionResult Create()
 {
     var model = new StoriesCreateModel();
     return View(model);
 }