Ejemplo n.º 1
0
        public async Task <IActionResult> Put(int id, [FromBody] MAS_CityDto input, CancellationToken ct = default(CancellationToken))
        {
            try
            {
                if (input == null)
                {
                    return(BadRequest());
                }
                if (await businessSupervisor.GetCityById(id, ct) == null)
                {
                    return(NotFound());
                }

                if (await businessSupervisor.UpdateMASCity(input, true, ct))
                {
                    return(Ok(input));
                }

                return(StatusCode(500));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> Post([FromBody] MAS_CityDto input, CancellationToken ct = default(CancellationToken))
 {
     try
     {
         if (input == null)
         {
             return(BadRequest());
         }
         return(StatusCode(201, await businessSupervisor.InsertMASCity(input, true, ct)));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex));
     }
 }