コード例 #1
0
ファイル: ShopService.cs プロジェクト: Cravvley/Compareo
        public async Task Create(Shop shop)
        {
            if (shop is null)
            {
                throw new ArgumentNullException("shop doesn't exist");
            }

            await _shopRepository.Create(shop);
        }
コード例 #2
0
        public async Task <object> Create([FromBody] ShopViewModel shopViewModel)
        {
            Shop shop = new Shop();

            try
            {
                shop = _shopRepository.Create(shopViewModel);
            }
            catch (Exception ex)
            {
                result = false;
                error  = ex.Message;
            }

            return(new SingleResponse <Shop>
            {
                Message = "Shop created successfully",
                DidError = false,
                ErrorMessage = string.Empty,
                Token = string.Empty,
                Model = shop
            });
        }