public async Task <ActionResult> Delete(int id) { var result = await _branch.DeActiveAsync(id); return (Json( new { redirectTo = Url.Action("Index", "Branch", new { Area = "Admin" }), message = result == 0 ? "Record deleted Failed!!!" : "Record deleted successfully!!!", position = "mainContent" })); }
public async Task <IHttpActionResult> Delete([FromBody] int id) { try { var branch = await _branch.DeActiveAsync(id); var result = new { Error = branch != 1, Message = branch != 1 ? "Branch Deactivation failed." : "", Data = branch }; return(Ok(result)); } catch (Exception ex) { ex.WriteLog(); return(BadRequest("Branch Deactivation failed.")); } }