public RedirectResult ApproveLeave(int?id, string userId, string returnUrl) { if (id != null && userId != null) { var result = leavemanagerRepo.Approveleave(id.Value, userId); if (result != false) { return(Redirect(returnUrl)); } } TempData["Error"] = "Something went wong and this request could not be completed. please retry in a moment"; return(Redirect(returnUrl)); }