public IActionResult SaveMap() { var Success = false; var Message = ""; var map = HttpContext.Session.GetString("Map"); mapRepository.Map = JsonSerializer.Deserialize <Map>(map); switch (mapRepository.SaveMap(User.Identity.Name)) { case 0: Success = true; Message = "Map Saved"; break; case 1: Message = "A map with this name already exists."; break; } return(Json(new { success = Success, message = Message })); }