// POST api/Armies public HttpResponseMessage Post(Army value) { if (ModelState.IsValid) { _armyRepository.InsertOrUpdate(value); _armyRepository.Save(); //Created! var response = Request.CreateResponse <Core.Army>(HttpStatusCode.Created, value); //Let them know where the new Armies is string uri = Url.Route(null, new { id = value.Id }); response.Headers.Location = new Uri(Request.RequestUri, uri); return(response); } throw new HttpResponseException(HttpStatusCode.BadRequest); }
public IActionResult Create(Army army) { armyRepo.Save(army); return(RedirectToAction("Index")); }