Beispiel #1
0
        public HttpResponseMessage GetUnassigned()
        {
            var repo       = new ComputerRespository();
            var results    = repo.GetAllUnassigned();
            var resultsDto = repo.ComputerReturn(results);

            return(Request.CreateResponse(HttpStatusCode.OK, resultsDto));
        }
Beispiel #2
0
        public HttpResponseMessage Create(ComputerDto computer)
        {
            var repo          = new ComputerRespository();
            var dtoToComputer = repo.ConvertComputer(computer);
            var result        = repo.AddNewComputer(dtoToComputer);

            if (!result)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Something went wrong with trying to create this employee. Please try again later."));
            }

            return(Request.CreateResponse(HttpStatusCode.Created, "Computer has been created!"));
        }