public ActionResult AddFormation(CreateFormationRequest createRequest) { if (_validator.Validate(createRequest)) { return(BadRequest("All formation information must be filled out.")); } var newFormation = _repository.AddFormation(createRequest.FormationName, createRequest.Location, createRequest.Formed, createRequest.Latitude, createRequest.Longitude, createRequest.Fossil); return(Created($"api/formation/{newFormation.Id}", newFormation)); }
public bool Validate(CreateFormationRequest requestToValidate) { return(string.IsNullOrEmpty(requestToValidate.FormationName) || string.IsNullOrEmpty(requestToValidate.Location)); }