Example #1
0
        public ActionResult Create([Bind(Include = "Title")] ProposalDraft draft)
        {
            if (ModelState.IsValid)
            {
                _proposalService.Create(draft);

                return(RedirectToAction("Index"));
            }

            return(View(draft));
        }
Example #2
0
        public async Task <IActionResult> Add([FromBody] CreateProposalModel model)
        {
            if (ModelState.IsValid)
            {
                if (!await ProposalService.Exists(model.Description))
                {
                    // This should be something
                    var isOk = await ProposalService.Create(model);

                    return(Ok(isOk));
                }

                ModelState.AddModelError("Status", "Er bestaat al een proposal met deze naam.");
            }

            return(BadRequest(ModelState));
        }