public ActionResult DeleteAddress(string id) { Guid addressId = Guid.Empty; if (Guid.TryParse(id, out addressId)) { var result = addressServices.DeleteAddress(addressId); if (result && Request.IsAjaxRequest()) { return(Json(true, JsonRequestBehavior.AllowGet)); } else if (result) { return(RedirectToAction("Address")); } else if (Request.IsAjaxRequest()) { return(Json(false, JsonRequestBehavior.AllowGet)); } else { return(RedirectToAction("Address")); } } return(HttpNotFound()); }
public HttpResponseMessage DeleteAddress(int id) { if (id > 0) { var isSuccess = _addressServices.DeleteAddress(id); if (isSuccess == 1) { return(Request.CreateResponse(HttpStatusCode.OK, true)); } throw new ApiDataException(1002, "Address is already deleted or not exist in system.", HttpStatusCode.NoContent); } throw new ApiException() { ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = "Bad Request..." }; }