public IActionResult Edit(int id, DiscoveryFormServiceModel model)
        {
            string oldName = this.discoveryService.GetName(id);

            if (oldName == null)
            {
                return(BadRequest());
            }

            string newName = model.StarSystem;

            if (this.discoveryService.Exists(newName) &&
                oldName != newName)
            {
                TempData.AddErrorMessage(string.Format(WebConstants.EntryExists, StarSystem));
                return(View(model));
            }

            bool success = this.discoveryService.Edit(id, model.StarSystem, model.Distance);

            if (!success)
            {
                return(BadRequest());
            }

            TempData.AddSuccessMessage(string.Format(WebConstants.SuccessfullEntityOperation, Discovery, WebConstants.Edited));

            return(RedirectToAction(nameof(Details), new { id }));
        }
        public IActionResult Edit(int id)
        {
            DiscoveryFormServiceModel model = this.discoveryService.GetForm(id);

            if (model == null)
            {
                return(BadRequest());
            }

            return(View(model));
        }