Ejemplo n.º 1
0
        public async Task <IActionResult> ChangeCountry([FromBody] ChangeCountry country)
        {
            if (ModelState.IsValid)
            {
                var newCountry = await changeCountryHandler.Handle(country);

                return(new JsonResult(new { value = new { value = newCountry.CountryId } }));
            }

            return(Json("Error"));
        }
Ejemplo n.º 2
0
 public Task Handle(object command)
 {
     return(command switch
     {
         Create cmd => HandleCreate(cmd),
         ChangeCity cmd
         => HandleUpdateAsync(cmd.Id, async c => await ChangeCityAsync(c, cmd.City.Id)),
         ChangeCountry cmd
         => HandleUpdateAsync(cmd.Id, async c => await ChangeCountryAsync(c, cmd.Country.Id)),
         DeleteLocation cmd => HandleUpdateAsync(cmd.Id, _ => this._repository.RemoveAsync(cmd.Id)),
         _ => Task.CompletedTask
     });
Ejemplo n.º 3
0
        public async Task <ActionResult> ChangeCountryDecleration(ChangeCountry id)
        {
            var Decleration = await db.Declerations.Where(w => w.UserDbId == id.userId && w.CountryId == id.CountryId && w.Executed == false && w.CreatAdmin == false && w.IsForeignWarehouse == true).ToListAsync();

            return(PartialView(Decleration));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> ChangeCountryOrder(ChangeCountry id)
        {
            var Orders = await db.Orders.Where(w => w.UserDbId == id.userId && w.CountryId == id.CountryId && w.Executed == false && w.isPaid == true && w.Ordered == true).ToListAsync();

            return(PartialView(Orders));
        }