public JsonResult SaveAddress(Address Address) { try { Address.Save(); return new JsonResult { Data = new { success = true, id = Address.Id } }; } catch (Exception ex) { return new JsonResult { Data = new { success = false, error = ex.Message } }; } }
public JsonResult DeleteAddress(int id) { try { Address address = new Address(id); address.Delete(); return new JsonResult { Data = new { success = true } }; // Return nothing as there are no errors } catch (Exception ex) { return new JsonResult { Data = new { success = false, error = ex.Message } }; } }