public IActionResult Index() { var storeowner = _distanceServices.GetById(1); if (storeowner == null) { return(NotFound()); } var model = new distanceEditViewModel() { id = storeowner.id, range = storeowner.range }; return(View(model)); }
public IActionResult changeorderStatus(int id, string status) { //orders obj = _ordersServices.GetById(id); //obj.orderstatus = status; //_ordersServices.UpdateAsync(obj); var paramter = new DynamicParameters(); paramter.Add("@id", id); paramter.Add("@orderstatus", status); //storedetailsListViewmodel _ISP_Call.Execute("orderStatus_Update", paramter); var orders = _ordersServices.GetById(id); int customerid = orders.customerid; int deliveryboyid = 0; string deliveryboyDeviceId = ""; string storeid = _ordersServices.GetById(id).storeid; var store = _storedetailsServices.GetAll().Where(x => x.storeid == storeid).FirstOrDefault(); string storeLatitude = store.latitude; string storelongitude = store.longitude; string storeName = store.storename; if (orders.deliveryboyid == null) { //deliveryboyid = (int)orders.deliveryboyid; } else { deliveryboyid = (int)orders.deliveryboyid; // deliveryboyDeviceId = _driverRegistrationServices.GetById(deliveryboyid).deviceid; } string customerDeviceId = _CustomerRegistrationservices.GetById(customerid).deviceid; if (status == "approved") { #region "customer" //string message = "New Order No. - " + id + " Approved by Admin"; //string title = "Order Approved"; string message = storeName + " Has Accepted Your Order"; string title = "Order Accepted"; objfcmNotification.customerNotification(customerDeviceId, message, "", title); #endregion #region "Deliveryboy" try { var distancedt = _distanceServices.GetById(1); var distance = distancedt.range; var paramter1 = new DynamicParameters(); paramter1.Add("@Latitude", storeLatitude); paramter1.Add("@Longitude", storelongitude); paramter1.Add("@distance", distance); var dt = _ISP_Call.List <getNeareDeliveryboybyLocation>("getNeareDeliveryboybyLocationNew", paramter1); foreach (var item in dt) { string deviceid = item.deviceid; //string message1 = "New Order No. - " + id + " Approved by Admin"; //string title1 = "Order Approved"; string message1 = "New Order Received"; string title1 = "New Order Received"; objfcmNotification.deliveryboyNotification(deviceid, message1, "", title1); } } catch (Exception ex) { string ss = ex.Message; throw ex; } // return Ok(sResponseFromServer); #endregion } else if (status == "cancelledorders") { #region "customer" string message = "Your Order No. - " + id + " has been cancelled"; string title = "Cancel Order"; objfcmNotification.customerNotification(customerDeviceId, message, "", title); #endregion } else if (status == "completedorders") { ////--------------------------- //if(orders.paymentstatus == "Cash on Delivery") //{ // var obj = _deliveryboyPendingAmtServices.GetAll().Where(x => x.deliveryboyid == orders.deliveryboyid).FirstOrDefault(); // if (obj == null) // { // var obj1 = new deliveryboyPendingAmt // { // id = 0, // deliveryboyid =(int)orders.deliveryboyid, // amount = orders.amount, // modifydate = DateTime.Now // }; // await _deliveryboyPendingAmtServices.CreateAsync(obj1); // } // else // { // } //} //else //{ //} //---------------------- #region "customer" string message = "Your Order No. - " + id + " has been Completed"; string title = "Completed Order"; objfcmNotification.customerNotification(customerDeviceId, message, "", title); #endregion } return(RedirectToAction("test")); }