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 RestarauntAllData CreateRestarauntAllData(Restaraunt restaraunt, RestarauntLang restLang) { RestarauntAllData result = new RestarauntAllData(); result.Address = restLang.Address; result.Country = restLang.Country; result.Locality = restLang.Locality; result.Region = restLang.Region; result.Review = restLang.Review; result.Name = restLang.Name; result.Longitude = restaraunt.Longitude; result.Latitude = restaraunt.Latitude; result.KitchenRate = restaraunt.KitchenRate; result.InteriorRate = restaraunt.InteriorRate; result.MaintenanceRate = restaraunt.MaintenanceRate; result.RestarauntType = restaraunt.RestarauntType; result.AddedDate = restaraunt.AddedDate; result.Images = imageRepository.GetRestarauntImages(restaraunt.RestarauntID); return(result); }
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" })); } }