public ActionResult AddClinker(CreateClinkerRequest createRequest)
        {
            if (_validator.Validate(createRequest))
            {
                return(BadRequest(new { error = "users must have a name and password" }));
            }

            var newClinker = _clinkerRepository.AddClinker(createRequest.Name, createRequest.Password, createRequest.Age, createRequest.IsPrisoner, createRequest.ReleaseDate);

            return(Created($"api/clinkers/{newClinker.Id}", newClinker));
        }
示例#2
0
 public IActionResult AddClinker(Clinker clinkerToAdd)
 {
     _repository.AddClinker(clinkerToAdd);
     return(Created($"Added Clinker {clinkerToAdd.Name}", clinkerToAdd));
 }
示例#3
0
        public IActionResult AddClinker(Clinker clinkerToAdd)
        {
            _repository.AddClinker(clinkerToAdd);

            return(Created("", clinkerToAdd));
        }