public IActionResult Add_unit(UnitAddViewModel model) { if (ModelState.IsValid) { string uniqueFileName = ProcessUpload(model); Units new_unit = new Units { Name = model.Name, Attack = model.Attack, Defense = model.Defense, min_Damage = model.min_Damage, max_Damage = model.max_Damage, Health = model.Health, Faction = model.Faction, PhotoPath = uniqueFileName }; unitRepository.Add_unit(new_unit); return(RedirectToAction("details", new { id = new_unit.Id })); } return(View()); }