示例#1
0
        public async Task <IActionResult> Put(int id, [FromBody] MAS_FoodTypeDto input, CancellationToken ct = default(CancellationToken))
        {
            try
            {
                if (input == null)
                {
                    return(BadRequest());
                }
                if (await businessSupervisor.GetFoodTypeById(id, ct) == null)
                {
                    return(NotFound());
                }

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

                return(StatusCode(500));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
示例#2
0
 public async Task <IActionResult> Post([FromBody] MAS_FoodTypeDto input, CancellationToken ct = default(CancellationToken))
 {
     try
     {
         if (input == null)
         {
             return(BadRequest());
         }
         return(StatusCode(201, await businessSupervisor.InsertMASFoodType(input, true, ct)));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex));
     }
 }