public ActionResult Add(Platform platform, string returnUrl = null)
        {
            ViewBag.returnUrl = returnUrl ?? Url.Content("~/");
            if (ModelState.IsValid)
            {
                var errors = _platformService.ValidatePlatform(platform);
                if (!errors.Any())
                {
                    _platformService.Add(platform);
                    if (returnUrl != null)
                    {
                        return(Redirect(returnUrl));
                    }
                    return(RedirectToAction("Manage"));
                }
                ModelState.Merge(errors);
            }

            ViewBag.Companies = _companyService.GetAll();
            return(View(platform));
        }
Esempio n. 2
0
 public IActionResult Add(PlatformDto PlatformDto)
 {
     _platformService.Add(PlatformDto);
     return(RedirectToAction(nameof(Index)));
 }