コード例 #1
0
ファイル: Shop.cs プロジェクト: pozniakas/MrLocalApi
        public async Task <IActionResult> Post([FromBody] Models.Shop body)
        {
            _logger.LogInfo("Creating shop");
            var createdShop = await shopService.CreateShop(body.Name, body.Description, body.TypeOfShop, body.City);

            _logger.LogInfo("Shop created");

            return(Ok(createdShop));
        }
コード例 #2
0
        public ActionResult Create(ShopCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var service = new ShopService();

            if (service.CreateShop(model))
            {
                TempData["SaveResult"] = "Shop added.";
                return(RedirectToAction("Create", "Artist"));
            }
            ModelState.AddModelError("", "Shop could not be added.");
            return(View(model));
        }