public ActionResult GetRestarauntInfo(int restarauntID) { try { if (!restarauntID.Equals(null)) { Restaraunt Restaraunt = restRepository.GetRestarauntByID(restarauntID); RestarauntLang RestarauntLang = restLangRepository.GetRestarauntLangByID(restarauntID); RestarauntAllData result = workWithDBProvider.CreateRestarauntAllData(Restaraunt, RestarauntLang); return(Json(new { result = result })); } return(Json(new { result = "JSON is null" })); } catch { return(Json(new { result = "NaN" })); } }
public ActionResult GetRestaurantInfo(int restarauntID) { try { if (!restarauntID.Equals(null)) { Restaraunt Restaraunt = restRepository.GetRestarauntByID(restarauntID); RestarauntLang RestarauntLang = restLangRepository.GetRestarauntLangByID(restarauntID); RestarauntAllData result = workWithDBProvider.CreateRestarauntAllData(Restaraunt, RestarauntLang); string tmp = String.Empty; foreach (var image in result.Images) // need debug. подумать как упростить { for (int i = image.Url.Length - 1; i >= 0; i--) { if (image.Url[i].Equals('\\')) { string NameAndExtension = new string(tmp.ToCharArray().Reverse().ToArray()); // gpj.<image_name> to <image_name>.jpg image.Url = image.Url.Remove(i + 1) + "small_" + NameAndExtension; tmp = string.Empty; break; } else { tmp += image.Url[i]; } } } return(Json(new { result = result })); } return(Json(new { result = "JSON is null" })); } catch { return(Json(new { result = "NaN" })); } }