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 NewRequirement(RequirementCreateModel 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.Requirement, cellID, null, model.Tag))
                    {
                        Warning("Já existe um requisito com este nome!");
                    }
                    else
                    {
                        int userID = Authentication.GetLoggedUser().UserID;
                        int ret = ctx.SaveRequirement(RequirementTypes.Requirement, cellID, null, userID, model.Message, model.Tag, model.Summary, model.Text, model.StoryId);

                        if (ret != 0)
                        {
                            Success("Requisito inserido com sucesso!");
                            return RedirectToRoute("Details", new { @cell = RouteData.Values["cell"], @controller = "Requirements", @tag = model.Tag, @action = "Details" });
                        }
                        else
                        {
                            Error("Erro ao tentar inserir o novo requisito!");
                        }
                    }
                }
            }
            else
            {
                Warning("Preencha o formulário corretamente!");
            }

            NewRequirementModel edit = new NewRequirementModel(model);
            RouteData.Values["title"] = edit.Story.Summary;
            return View(edit);
        }