public async Task <ActionResult> UpdateStatusPackage(int id, int statusUpdate) { var result = new CustomeResultDTO(); try { result = _orderService.Admin_UpdateStatusPackage(id, statusUpdate); if (result.Result == 1 && statusUpdate == (int)OrderStatusInfo.SendToVN) { //new KerryService().PostNewOrder(id); await Task.Run(() => _iKerryService.PostNewOrder(id)); } } catch (Exception ex) { result.Message = ex.Message; } return(Json(result)); }
public async Task <IHttpActionResult> UpdateStoreStatus(JObject jObject) { //_Log.Info("api/app/store/updatestatus: " + jObject.ToJson()); Libraries.Log.Write("api/app/store/updatestatus: " + jObject.ToJson()); var response = new Response(); try { JToken jToken; if (!jObject.TryGetValue("PackageId", out jToken)) { return(Ok(response.Failed("PackageId invalid !"))); } var packageId = jToken.Value <int>(); if (!jObject.TryGetValue("UpdateStatus", out jToken)) { return(Ok(response.Failed("UpdateStatus invalid !"))); } var updateStatus = jToken.Value <int>(); var appTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); if (jObject.TryGetValue("AppTime", out jToken)) { appTime = jToken.Value <string>(); } var result = _iOrderServices.App_UpdateStatusPackage(packageId, updateStatus); if (result.Result == 1 && updateStatus == (int)OrderStatusInfo.SendToVN) { //tạo vận đơn bên kerry await Task.Run(() => _iKerryServices.PostNewOrder(packageId)); } return(Ok(result.Result == 1 ? response.SetData(result.Message) : response.Failed(result.Message))); } catch (Exception ex) { return(Ok(response.System(ex))); } }