public ActionResult Create([Bind(Include = "Authorid,FirstName,Insertion,LastName,Birthdate")] Authors authors) { if (ModelState.IsValid) { db.Authors.Add(authors); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(authors)); }
private void UpdateBookNumber(int id, int number, DateTime modifyTime) { Log("Информация", $"Запрос к БД на обновление количества Книги (Id - {id})."); var book = db.Book.FirstOrDefault(b => b.Id == id); book.ModifyTime = modifyTime; book.Number += number; int updateNumber = db.SaveChanges(); Log("Информация", $"Обновлено книг: {updateNumber}"); }
public ActionResult Create([Bind(Include = "Publisherid,FullName,City")] Publishers publishers) { if (ModelState.IsValid) { db.Publishers.Add(publishers); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(publishers)); }
public ActionResult Create([Bind(Include = "Bookid,Title,Authorid,Publisherid,Languages,Dimensions,Weights,Prints,ISBN,Cover")] Books books) { if (ModelState.IsValid) { db.Books.Add(books); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Authorid = new SelectList(db.Authors, "Authorid", "FirstName", books.Authorid); ViewBag.Publisherid = new SelectList(db.Publishers, "Publisherid", "FullName", books.Publisherid); return(View(books)); }
public ActionResult Create([Bind(Include = "Magazineid,Title,Authorid,Publisherid,Publishdate,Languages,Dimensions,ISSN,Cover")] Magazines magazines) { if (ModelState.IsValid) { db.Magazines.Add(magazines); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Authorid = new SelectList(db.Authors, "Authorid", "FirstName", magazines.Authorid); ViewBag.Publisherid = new SelectList(db.Publishers, "Publisherid", "FullName", magazines.Publisherid); return(View(magazines)); }