public async Task <dynamic> Execute(ContextDto context) { dynamic result = new System.Dynamic.ExpandoObject(); var repo = new KhoHangHoaRepository(context); await repo.Delete(Id); result.data = await repo.Delete(Id); return(result); }
public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var count = 0; var repo = new KhoHangHoaRepository(context); for (int i = 0; i < _listId.Count; i++) { if (_listId[i] > 0 && await repo.Delete(_listId[i])) { count++; } } return(returnActionResult(HttpStatusCode.OK, count, null)); } catch (FormatException ex) { return(returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }