public ActionResult Create(Assignment assignment)
        {
            if (ModelState.IsValid)
            {
                _assignmentService.Add(assignment);
                return(RedirectToAction("Details", "Assignments", new { id = assignment.Id }));
            }

            return(RedirectToAction("Create"));
        }
        public void Post([FromBody] AssignmentModelAPI assignmentModelAPI)
        {
            var user = new AssignmentModel()
            {
                Deadline = assignmentModelAPI.Deadline, LabID = assignmentModelAPI.LabID, Title = assignmentModelAPI.Title, Description = assignmentModelAPI.Description
            };

            assignmentService.Add(user);
        }
Exemple #3
0
 private void bttn_teslimalan_teslimet_Click_1(object sender, EventArgs e)
 {
     if (cb_book_selectbook.SelectedIndex == -1)
     {
         _ = new uc_alertbox("İşlem yapılacak kitap seçilmemiş.", uc_alertbox.AlertType.Error, this); return;
     }
     if (cb_book_selectbarcod.Text == "<kitap seçilmemiş>" || cb_book_selectbarcod.Text == "<barkod seçin>")
     {
         _ = new uc_alertbox("Aynı ada sahip başka bir kitap mevcut. Barkot numarasını listeden seçin.", uc_alertbox.AlertType.Error, this); return;
     }
     if (cb_user_selectuser.Text == "<branş seçilmemiş>" || cb_user_selectuser.Text == "<kayıt yok>")
     {
         _ = new uc_alertbox("Kitabın kime teslim edileceği seçilmemiş.", uc_alertbox.AlertType.Error, this); return;
     }
     if (cb_user_selectbranch.SelectedIndex == -1)
     {
         _ = new uc_alertbox("Teslim alan kişinin branşı seçilmemiş.", uc_alertbox.AlertType.Error, this); return;
     }
     AssignmentService.Add(new Assignment()
     {
         UserId     = UserService.Get(p => p.BranchId == BranchService.Get(f => f.Name == cb_user_selectbranch.SelectedItem.ToString()).Id&& p.Name == cb_user_selectuser.SelectedItem.ToString()).Id,
         Barcod     = Convert.ToInt64(cb_book_selectbarcod.SelectedItem),
         Notes      = tb_teslimalan_ekstranot.Text,
         AssignDate = (int)(DateTime.Now.Subtract(new DateTime(1970, 1, 1))).TotalSeconds,
         DealedDate = (int)(dtp_teslimalan.Value.Subtract(new DateTime(1970, 1, 1))).TotalSeconds,
         Statu      = 1
     });
     BookService.Modify(new Book()
     {
         Id     = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Id,
         RCount = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).RCount + 1,
         Name   = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Name,
         Author = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Author,
         Barcod = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Barcod,
         Statu  = 1,
     });
     _ = new uc_alertbox("Kitap teslim kaydı açıldı!", uc_alertbox.AlertType.Success, this);
     LoadBooks();
 }