public JsonResult Deactivate(int Id) { try { Client Client = new Client(Id); Client.Active = false; Client.Save(); 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 } }; } }
public JsonResult Save(Client Client) { try { Client.Save(); return new JsonResult { Data = new { success = true, id = Client.Id } }; // Return the client Id if there are no errors } catch (Exception ex) { return new JsonResult { Data = new { success = false, error = ex.Message } }; } }