Ejemplo n.º 1
0
        public async Task <bool> HandleAsync(CreateMenuItemRequest message, IOutputPort <ServiceResponse> outputPort)
        {
            var response = await _menuItemRepository.AddMenuItem(message.ClientSideId, message.Label, message.DisplayOrder);

            outputPort.Handle(response.Success ? new ServiceResponse(response.Id, true) : new ServiceResponse(response.Errors.Select(e => e.Description)));
            return(response.Success);
        }
 public IActionResult AddMenuItem([FromBody] MenuItem item)
 {
     try
     {
         _log4net.Info("Adding menu item with id " + item.Id);
         repository.AddMenuItem(item);
         return(Ok(item));
     }
     catch
     {
         _log4net.Error("Failed to add menu item with id:" + item.Id + "name: " + item.Name);
         return(new BadRequestResult());
     }
 }
 public void AddMI(MenuItem MI)
 {
     _MIRepo.AddMenuItem(MI);
 }