public async Task <TblOperation> AddOperation(TblOperation operation) { HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync("api/OperationCore/AddOperation", operation); TblOperation ans = await httpResponseMessage.Content.ReadAsAsync <TblOperation>(); return(ans); }
public async Task <TblOperation> DeleteOperation(int id) { HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync($"api/DeleteOperation/DeleteOperation?id={id}", id); TblOperation ans = await httpResponseMessage.Content.ReadAsAsync <TblOperation>(); return(ans); }
public DtoTblOperation(TblOperation operation, HttpStatusCode statusEffect) { id = operation.id; OperationName = operation.OperationName; OperationPrice = operation.OperationPrice; StatusEffect = statusEffect; }
public async Task <bool> UpdateOperation(TblOperation operation, int logId) { List <object> operationAndLogId = new List <object>(); operationAndLogId.Add(operation); operationAndLogId.Add(logId); HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync("api/OperationCore/UpdateOperation", operationAndLogId); bool ans = await httpResponseMessage.Content.ReadAsAsync <bool>(); return(ans); }
public IHttpActionResult AddOperation(TblOperation operation) { var task = Task.Run(() => new OperationService().AddOperation(operation)); if (task.Wait(TimeSpan.FromSeconds(10))) { if (task.Result.id != -1) { return(Ok(new DtoTblOperation(task.Result, HttpStatusCode.OK))); } else { return(Conflict()); } } return(StatusCode(HttpStatusCode.RequestTimeout)); }
public IHttpActionResult UpdateOperation(List <object> operationLogId) { TblOperation operation = JsonConvert.DeserializeObject <TblOperation>(operationLogId[0].ToString()); int logId = JsonConvert.DeserializeObject <int>(operationLogId[1].ToString()); var task = Task.Run(() => new OperationService().UpdateOperation(operation, logId)); if (task.Wait(TimeSpan.FromSeconds(10))) { if (task.Result) { return(Ok(true)); } else { return(Conflict()); } } return(StatusCode(HttpStatusCode.RequestTimeout)); }
public TblOperation AddOperation(TblOperation operation) { return(new OperationRepo().AddOperation(operation)); }
public bool UpdateOperation(TblOperation operation, int logId) { return(new OperationRepo().UpdateOperation(operation, logId)); }
public bool UpdateOperation(TblOperation operation, int logId) { return(new MainProvider().Update(operation, logId)); }
public TblOperation AddOperation(TblOperation operation) { return((TblOperation) new MainProvider().Add(operation)); }