public FamousPersonInfo Get(int id) { var person = FamousPersonService.FindById(id); if (person == null) { throw new CustomerApiException(HttpStatusCode.NotFound, 1, "该名人不存在"); } return(person); }
public FamousPersonInfo Save([FromBody] FamousPersonInfo value) { if (value != null && ModelState.IsValid) { return(FamousPersonService.Save(value)); } else { throw new CustomerApiException(HttpStatusCode.NotAcceptable, 1, "字段值不合法"); } }
public void Update(int id, [FromBody] FamousPersonInfo value) { if (value != null && ModelState.IsValid) { value.FamousPersonId = id; FamousPersonService.Update(value); //不处理图片文件了 } else { throw new CustomerApiException(HttpStatusCode.NotAcceptable, 1, "字段值不合法"); } }
public FamousPeopleController(FamousPersonService service) { _service = service; }
public FamousPersonApiController(FamousPersonService famousPersonService, ILogger <FamousPersonApiController> log) { _log = log; _famousPersonService = famousPersonService; }
public ExceptionHandlerFilter(FamousPersonService famousPersonService, ILogger <ExceptionHandlerAttribute> logger) { _logger = logger; _famousPersonService = famousPersonService; }
public IEnumerable <FamousPersonInfo> Search([FromBody] PersonSearchModel searchModel) { return(FamousPersonService.Search(searchModel)); }
public void Delete(int id) { FamousPersonService.Delete(id); }
public IEnumerable <FamousPersonInfo> Get() { return(FamousPersonService.FindAll()); }
public EnsurePersonExistsFilter(FamousPersonService famousPersonService, ILogger <EnsurePersonExistsAttribute> log) { _log = log; _famousPersonService = famousPersonService; }