фикшу мелкие баги
This commit is contained in:
parent
8ee189b6c2
commit
7f84700e8e
@ -21,15 +21,18 @@ namespace IceCreamShopRestApi.Controllers
|
||||
_logic = logic;
|
||||
}
|
||||
[HttpGet]
|
||||
public ShopViewModel GetShop(ShopSearchModel model)
|
||||
public Tuple<ShopViewModel, List<Tuple<string, int>>>? GetShop(int shopId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(model);
|
||||
var elem = _logic.ReadElement(new ShopSearchModel { Id = shopId });
|
||||
if (elem == null)
|
||||
return null;
|
||||
return Tuple.Create(elem, elem.ShopIceCreams.Select(x => Tuple.Create(x.Value.Item1.IceCreamName, x.Value.Item2)).ToList());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка магазинов");
|
||||
_logger.LogError(ex, "Ошибка получения магазина по id={Id}", shopId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ namespace IceCreamShopsApp.Controllers
|
||||
ShopName = name,
|
||||
Address = address,
|
||||
DateOpen = dateOpen,
|
||||
MaxCapacity = maxCapacity
|
||||
MaxCapacity = maxCapacity,
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
@ -51,25 +51,29 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('#shop').on('change', function () {
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var shop = $('#shop').val();
|
||||
if (shop) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetShop",
|
||||
data: { shopId: shop },
|
||||
success: function (result) {
|
||||
$('#name').val(result.item1.shopName);
|
||||
$('#address').val(result.item1.address);
|
||||
$('#dateopen').val(result.item1.dateOpen);
|
||||
$('#maxcapacity').val(result.item1.maxCapacity);
|
||||
$('#table-elements').html(result.item2);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
});
|
||||
function check() {
|
||||
var shop = $('#shop').val();
|
||||
if (shop) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetShop",
|
||||
data: { shopId: shop },
|
||||
success: function (result) {
|
||||
$('#name').val(result.item1.shopName);
|
||||
$('#address').val(result.item1.address);
|
||||
$('#dateopen').val(result.item1.dateOpen);
|
||||
$('#maxcapacity').val(result.item1.maxCapacity);
|
||||
$('#table-elements').html(result.item2);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
</script>
|
||||
$('#shop').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
Loading…
Reference in New Issue
Block a user