Example #1
0
 public ActionResult DeleteAddress(int addressId, int buildingId)
 {
     try
     {
         var deleted = AddressManager.DeleteBuildingAdress(addressId, buildingId);
         if (deleted)
         {
             return(Json(new { message = "Deleted", addressId = addressId }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { message = "A building should have atleast one address.", addressId = 0 }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception)
     {
         return(Json(new { message = "Delete error", addressId = addressId }, JsonRequestBehavior.AllowGet));
     }
 }