コード例 #1
0
        public IActionResult CreateInmate(AddInmateCommand newAddInmateCommand)
        {
            var newInmate = new Inmate
            {
                Id               = Guid.NewGuid(),
                Name             = newAddInmateCommand.Name,
                Location         = newAddInmateCommand.Location,
                CriminalInterest = newAddInmateCommand.CriminalInterest,
                ReleaseDate      = newAddInmateCommand.ReleaseDate,
            };

            var repo = new InmateRepository();

            var inmateThatGotCreated = repo.Add(newInmate);

            return(Created($"api/inmates/{inmateThatGotCreated.Name}", inmateThatGotCreated));
        }
コード例 #2
0
        public IActionResult CreateInmate(AddInmateCommand newInmateCommand)
        {
            var newInmate = new Inmate
            {
                id               = newInmateCommand.id,
                Name             = newInmateCommand.Name,
                ConvictedDate    = newInmateCommand.ConvictedDate,
                LengthOfSentence = newInmateCommand.LengthOfSentence,
                CrimeCharged     = newInmateCommand.CrimeCharged,
                Crew             = newInmateCommand.Crew,
                Clique           = newInmateCommand.Clique,
                Beefs            = newInmateCommand.Beefs,
                Interests        = newInmateCommand.Interests,
            };
            var repo = new InmateRepository();
            var inmateThatGotCreated = repo.Add(newInmate);

            return(Created($"api/Inmate/{inmateThatGotCreated.Name}", inmateThatGotCreated));
        }