예제 #1
0
 public ActionResult AddRestaurant(RestaurantData data)
 {
     if (!data.Equals(null))
     {
         try
         {
             Restaraunt NewRestaraunt = data.RestarauntData;
             RestarauntLang NewRestLang = data.RestaurantLangData;
             NewRestaraunt.AddedDate = DateTime.Now;
             NewRestaraunt.RestarauntType = Restaraunt.RestType.Bar;
             restRepository.SaveRestaraunt(NewRestaraunt);
             NewRestLang.LanguageID = 1;
             NewRestLang.RestarauntID = NewRestaraunt.RestarauntID;
             restLangRepository.SaveRestarauntLang(NewRestLang);
             return Json(new { result = "success", id = NewRestaraunt.RestarauntID });
         }
         catch
         {
             return Json(new { result = "error", message = "Ooooooops! Some troubles was happened with DB." });
         }
     }
     return Json(new { result = "error", message = "JSON IS NULL" });
 }
예제 #2
0
 public ActionResult EditRestaurant(RestaurantData data)
 {
     if (!data.Equals(null))
     {
         try
         {
             Restaraunt EditRestaraunt = data.RestarauntData;
             RestarauntLang EditRestLang = data.RestaurantLangData;
             restRepository.SaveRestaraunt(EditRestaraunt);
             restLangRepository.SaveRestarauntLang(EditRestLang);
             return Json(new { result = "success" });
         }
         catch
         {
             return Json(new { result = "error", message = "Ooooooops! Some troubles was happened with DB." });
         }
     }
     return Json(new { result = "error", message = "JSON IS NULL" });
 }