Beispiel #1
0
        public async Task <string> ChangeCashPaymentStatus(string paymentstatus, int oid)
        {
            orders obj = _ordersServices.GetById(oid);// await _usermanager.GetUserAsync(User);

            if (obj == null)
            {
                return("NotFound");
            }
            else
            {
                obj.deliveryboyCheckStaus = "completed";
                obj.paymentstatus         = paymentstatus;
                await _ordersServices.UpdateAsync(obj);

                return("success");
            }
            return("");
        }
Beispiel #2
0
        public async Task <IActionResult> AdminAssignDeliveryboytoOrderId(int orderid, int deliveryboyid)
        {
            orders obj = _ordersServices.GetById(orderid);// await _usermanager.GetUserAsync(User);

            if (obj == null)
            {
                string myJson = "{\"message\": " + "\"Record Not Found\"" + "}";
                return(NotFound(myJson));
            }
            else
            {
                if (string.IsNullOrEmpty(Convert.ToString(obj.deliveryboyid)))
                {
                    obj.deliveryboyid = deliveryboyid;
                    obj.acceptedby    = "Admin";
                    await _ordersServices.UpdateAsync(obj);

                    var          driverdetails   = _driverRegistrationServices.GetById(deliveryboyid);
                    orderhistory objorderhistory = new orderhistory();
                    objorderhistory.oid         = orderid;
                    objorderhistory.placedate   = DateTime.UtcNow;
                    objorderhistory.orderstatus = "Admin assign Order to this Delivery boy." + driverdetails.name + "  . OrderID  :" + orderid;
                    await _orderhistoryServices.CreateAsync(objorderhistory);

                    #region "Notification customer and store"
                    int             customerid         = obj.customerid;
                    string          customerDeviceId   = _CustomerRegistrationservices.GetById(customerid).deviceid;
                    string          customerMsg        = driverdetails.name + " will be Delivering Your order";
                    string          customerTitle      = "Delivering Your order";
                    fcmNotification objfcmNotification = new fcmNotification();
                    objfcmNotification.customerNotification(customerDeviceId, customerMsg, "", customerTitle);

                    var    storeDeviceId = _usermanager.Users.Where(x => x.Id == obj.storeid).FirstOrDefault().deviceid;
                    string storeMsg      = "Admin Assign delivery boy " + driverdetails.name + " to this Order Id : " + orderid;
                    string storeTitle    = "Assign Deliveryboy";
                    objfcmNotification.storeNotification(storeDeviceId, storeMsg, "", storeTitle);

                    #endregion


                    string myJson = "{\"message\": " + "\"Order Assign To Delivery boy Successfully\"" + "}";
                    return(Ok(obj));
                }
                else
                {
                    string myJson = "{\"message\": " + "\"This Order Id Already assign delivery boy\"" + "}";
                    return(BadRequest(myJson));
                }
            }
        }