public IActionResult AddLocation([FromForm] NewLocationViewModel locationData)
        {
            if (!ModelState.IsValid || locationData == null)
            {
                return(PartialView("_AddLocationPartial", locationData));
            }

            try
            {
                var customer = customerService.GetCustomerById(locationData.CustomerId);

                var newLocation = LocationAddress.Create(
                    locationData.Country,
                    locationData.City,
                    locationData.Street,
                    locationData.StreetNumber,
                    locationData.PostalCode);

                customerService.AddLocationToCustomer(customer.Id, newLocation);

                return(PartialView("_AddLocationPartial", locationData));
            }
            catch (CustomerNotFoundException notFound)
            {
                logger.LogError("Failed to find the customer entity {@Exception}", notFound.Message);
                logger.LogDebug("Failed to find the customer entity {@ExceptionMessage}", notFound);
                return(BadRequest("Failed to find user"));
            }
            catch (Exception e)
            {
                logger.LogError("Failed to add a new Location {@Exception}", e.Message);
                logger.LogDebug("Failed to add a new Location {@ExceptionMessage}", e);
                return(BadRequest("Failed to create a new Location"));
            }
        }
        public IActionResult NewOrder([FromForm] NewOrderViewModel orderData)
        {
            try
            {
                var sender = customerService.GetCustomerById(orderData.SenderId);

                if (orderData.PickupLocationId == null && orderData.DeliveryLocationId == null)
                {
                    return(PartialView("_NewOrderPartial", orderData));
                }

                if (orderData.PickupLocationId == null || orderData.DeliveryLocationId == null)
                {
                    var bonusLocation = LocationAddress.Create(orderData.NewLocation.Country,
                                                               orderData.NewLocation.City, orderData.NewLocation.Street,
                                                               orderData.NewLocation.StreetNumber, orderData.NewLocation.PostalCode);

                    customerService.AddLocationToCustomer(sender.Id, bonusLocation);

                    if (orderData.PickupLocationId == null)
                    {
                        orderData.PickupLocationId = bonusLocation.Id.ToString();
                    }

                    if (orderData.DeliveryLocationId == null)
                    {
                        orderData.DeliveryLocationId = bonusLocation.Id.ToString();
                    }
                }

                var recipient = orderService.CreateNewRecipient(orderData.RecipientName,
                                                                orderData.RecipientPhoneNo,
                                                                orderData.RecipientEmail);

                orderService.CreateOrder(recipient,
                                         sender,
                                         orderData.PickupLocationId,
                                         orderData.DeliveryLocationId,
                                         orderData.Price);

                return(PartialView("_NewOrderPartial", orderData));
            }
            catch (Exception e)
            {
                logger.LogError("Failed to create a new Order {@Exception}", e.Message);
                logger.LogDebug("Failed to create a new Order {@ExceptionMessage}", e);
                return(BadRequest(e.Message));
            }
        }