public async Task <ActionResult> PublishOrUnpublish(int id, int?packageId) { var check = await _assignmentService.Get(id); if (check.IsPublished == true) { check.IsPublished = false; } else { check.IsPublished = true; } await _assignmentService.Edit(check); return(RedirectToAction("Assignment", new { packageId = packageId })); }