public IActionResult AddClinker(Clinker clinkerToAdd) { var existingClinker = _repository.GetById(clinkerToAdd.Id); if (existingClinker == null) { _repository.Add(clinkerToAdd); return(Created("", clinkerToAdd)); } else { return(NotFound("Yo this didn't work")); } }
public IActionResult CreateClinker(NewClinkerCommand newClinkerCommand) { Clinker newClinker = new Clinker { Id = Guid.NewGuid(), Name = newClinkerCommand.Name, InmateNum = newClinkerCommand.InmateNum, FriendsList = new List <Guid>(), EnemiesList = new List <Guid>(), Services = new List <Guid>(), Interests = new List <Guid>(), }; ClinkerRepository repo = new ClinkerRepository(); var clinkerThatGotCreated = repo.Add(newClinker); return(Created($"api/clinkers/{clinkerThatGotCreated.Id}", clinkerThatGotCreated)); }
public IActionResult CreateClinker(AddClinkerCommand newClinkerCommand) { var intId = new ClinkerRepository().GetAll().Count() + 1; var newClinker = new Clinker { Id = intId, UniqueId = Guid.NewGuid(), Name = newClinkerCommand.Name, Service = newClinkerCommand.Service, Interest = newClinkerCommand.Interest, Friends = newClinkerCommand.Friends, Enemies = newClinkerCommand.Enemies }; var repo = new ClinkerRepository(); var createdClinker = repo.Add(newClinker); return(Created($"api/clinkers/{createdClinker.Name}", createdClinker)); }
public IActionResult AddNewClinker(Clinker clinker) { _repo.Add(clinker); return(Created($"api/Clinkers/{clinker.Id}", clinker)); }
public IActionResult AddClinker(Clinker clinker) { _repo.Add(clinker); return(Created($"api/clinkers/{clinker.Name}", clinker)); }
public IActionResult AddAClinker(Clinker clinker) { _repo.Add(clinker); return(Created($"/api/Clinker/{clinker.SerialNumber}", clinker)); }