Esempio n. 1
0
        public async Task <IHttpActionResult> Delete(int id)
        {
            Banner entity = await BannerService.FindOneAsync(id);

            if (entity == null)
            {
                return(NotFound());
            }
            await BannerService.DeleteAsync(entity);

            return(Ok(entity.ToModel()));
        }
Esempio n. 2
0
        public JsonResult Delete(int id)
        {
            if (id <= 0)
            {
                return(Error("id错误"));
            }

            try
            {
                return(Json(new ResultBase
                {
                    success = _bannserService.DeleteAsync(id)
                }));
            }
            catch (Exception ex)
            {
                LogHelper.Error("BannerController.Delete异常", ex);
                return(Error(ex.Message));
            }
        }