예제 #1
0
 public JsonResult SaveBuilding(decimal id, string building_name, string address1,
     string postal_code, decimal? year_built, decimal? storeys, decimal? landlord_contact_id,
     decimal? owner_contact_id, decimal? latitude, decimal? longitude)
 {
     try
     {
         OracleRepository repo = new OracleRepository();
         bool result = true;
         if (landlord_contact_id==0)
         {
             landlord_contact_id = null;
         }
         if (owner_contact_id ==0)
         {
             owner_contact_id = null;
         }
         if (latitude == null)
         {
             latitude = 0;
         }
         if (longitude ==null)
         {
             longitude = 0;
         }
         result = result && repo.UpdateBuilding(id, building_name, address1, postal_code, year_built, storeys, landlord_contact_id,
             owner_contact_id,  User.Identity.Name) && repo.InsertLatLng(id, latitude, longitude);
         return Json(result, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(ex.Message, JsonRequestBehavior.AllowGet);
     }
 }