示例#1
0
        public HttpResponseMessage Update([FromBody] LaboratoryAPIModel laboratoryAPIModel)
        {
            if (laboratoryAPIModel == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            if (_laboratoryService.CheckIfLaboratoryExists(laboratoryAPIModel.LabNumber) == true)
            {
                _laboratoryService.UpdateLaboratory(_laboratoryAPIMapper.Map(laboratoryAPIModel));
                return(Request.CreateResponse(HttpStatusCode.Created, _laboratoryAPIMapper.Map(laboratoryAPIModel)));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.Conflict, "Laboratory not added yet!"));
            }
        }