示例#1
0
        public IActionResult GetByName([Required] string officeName)
        {
            var office = _officeRepository.FindByName(officeName);

            if (office == null)
            {
                return new ContentResult
                       {
                           Content    = $"No (unique) office found with name {officeName}",
                           StatusCode = (int)HttpStatusCode.NotFound
                       }
            }
            ;
            return(new ObjectResult(office));
        }
    }