Очень быстрое и грязное решение может быть следующим, вы можете немного подправить его тут и там;)
Я предполагаю, что у вас уже есть 225 делителей, представляющих ячейки на вашей странице, с идентификатором, например, от cell_1 до cell_225.
Просмотр:
$.ajax({
beforeSend: function () { ShowAjaxLoader(); },
url: "/Game/ShowTiles",
type: "POST",
contentType: "application/json;charset=utf-8",
dataType: "json",
data: JSON.stringify(tile),
success: function (data) {
$.each(data, function (index, item) {
if (item) {
var cellnumber = ((item.Y * 15) + item.X);
$("#cell_" + cellnumber).innerText = item.Value;
}
});
HideAjaxLoader();
},
error: function () {
HideAjaxLoader();
}
});
Контроллер / Модель:
public class MapModel
{
public TileModel[,] MapTilesArray;
public MapModel()
{
MapTilesArray = new TileModel[15, 15];
}
}
public class TileModel
{
public int X;
public int Y;
public int Value { get; set; }
}
[HttpPost]
public ActionResult ShowTiles(TileModel tile)
{
MapModel map = new MapModel();
map.MapTilesArray[tile.X, tile.Y] = new TileModel { X = tile.X, Y=tile.Y, Value = 1};
return Json(map.MapTilesArray);
}