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 })); }
public async Task <ActionResult> AssignmentDetail(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var item = await _assignmentService.Get(id); if (item == null) { return(HttpNotFound()); } var user = User.Identity.GetUserId(); var check = await db.AssignmentAnswers.FirstOrDefaultAsync(x => x.AssignmentId == id && x.UserId == user); if (check != null) { if (item.DateSubmitionEnds > DateTime.UtcNow.Date) { ViewBag.status = "<span class=\"\" style=\"font-weight:bolder;\">You Have Submited and can EDIT</span>"; } else { ViewBag.status = "<span class=\"text-success\" style=\"font-weight:bolder;\">You Have Submited and CANNOT EDIT </span>"; } } else { if (item.DateSubmitionEnds > DateTime.UtcNow.Date) { ViewBag.status = "<span class=\"text-warning\" style=\"font-weight:bolder;\">You Have Not Submited</span>"; } else { ViewBag.status = "<span class=\"text-danger\" style=\"font-weight:bolder;\">You Missed the Assignment</span>"; } } return(View(item)); }
private void cb_kitapsec_barkotno_SelectedIndexChanged(object sender, EventArgs e) { if (cb_book_selectbarcod.SelectedIndex == -1) { return; } Book _book = new Book(); Assignment _assignment = new Assignment(); MessageBox.Show(Convert.ToInt64(cb_book_selectbarcod.SelectedItem).ToString() + " " + Convert.ToInt64(cb_book_selectbarcod.SelectedItem).ToString() + " " + AssignmentService.GetMAX(f => f.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Id.ToString()); _assignment = AssignmentService.Get(P => P.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem) && P.Id == AssignmentService.GetMAX(f => f.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Id); _book = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)); lbl_teslimeden_fark.Text = string.Format("bu kitap {0} bu kişide.", FarkHesapla(_assignment.AssignDate)); tb_teslimeden_ekstranot.Text = _assignment.Notes; lbl_kitapsec_okunmasayi.Text = _book.RCount.ToString(); lbl_kitapsec_yazar.Text = _book.Author; lbl_telsimeden_isim.Text = UserService.Get(p => p.Id == _assignment.UserId).Name; }
public ActionResult <List <Assignment> > Get() => Ok(_service.Get());