public async Task <ShopBridgeItemUIModel> CreateItem(ShopBridgeItemUIModel shopbridgeItemUIModel) { try { return(await ShopBridgeItemService.Create(shopbridgeItemUIModel)); } catch (ApplicationException ax) { Logger.LogWarning(ax.Message); throw ax; } catch (Exception ex) { Logger.LogError(ex.Message); throw ex; } }
public async Task <ShopBridgeItemUIModel> Create(ShopBridgeItemUIModel uiModel) { if (string.IsNullOrEmpty(uiModel.Name)) { throw new ApplicationException("Name is required"); } try { var dataModel = new ShopBridgeItemModel { Name = uiModel.Name, Description = uiModel.Description, Price = uiModel.Price, ImagePath = uiModel.ImagePath, CreatedBy = uiModel.CreatedByUserId, CreatedOn = DateTime.Now }; dataModel = await ShopBridgeItemRepository.Create(dataModel); uiModel.Id = dataModel.Id; } catch (Exception ex) { throw ex; } return(uiModel); }