Пример #1
0
 public ActionResult Edit([Bind(Include = "pub_id,pub_name,city,state,country")] publishers publishers, [Bind(Include = "logo,pr_info")] pub_info pubInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(publishers).State = EntityState.Modified;
         db.Entry(pubInfo).State    = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.pub_id = new SelectList(db.pub_info, "pub_id", "pr_info", publishers.pub_id);
     return(View(publishers));
 }
Пример #2
0
 public ActionResult Edit([Bind(Include = "title_id,title1,type,pub_id,price,advance,royalty,ytd_sales,notes,pubdate")] title title, string[] author_ids)
 {
     if (ModelState.IsValid)
     {
         foreach (var ta in db.titleauthors.Where(ta => ta.title_id == title.title_id).ToList())
         {
             db.titleauthors.Remove(ta);
         }
         foreach (var aid in author_ids)
         {
             titleauthor ta = new titleauthor();
             ta.au_id    = aid;
             ta.title_id = title.title_id;
             db.titleauthors.Add(ta);
         }
         db.Entry(title).State = EntityState.Modified;
         db.SaveChanges();
         TempData["message_css"] = "alert alert-success";
         TempData["message"]     = "Successful";
         return(RedirectToAction("Index"));
     }
     ViewBag.pub_id          = new SelectList(db.publishers, "pub_id", "pub_name", title.pub_id);
     ViewBag.author_ids      = new MultiSelectList(db.authors.Select(a => new { id = a.au_id, au_fulname = a.au_lname + " " + a.au_fname }), "id", "au_fulname");
     TempData["message_css"] = "alert alert-danger";
     TempData["message"]     = "Invalid input";
     return(View(title));
 }
 public ActionResult Edit([Bind(Include = "au_id,au_lname,au_fname,phone,address,city,state,zip,contract")] authors authors)
 {
     if (ModelState.IsValid)
     {
         db.Entry(authors).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(authors));
 }
 public ActionResult Edit([Bind(Include = "stor_id,stor_name,stor_address,city,state,zip")] store store)
 {
     if (ModelState.IsValid)
     {
         db.Entry(store).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(store));
 }
 public ActionResult Edit([Bind(Include = "job_id,job_desc,min_lvl,max_lvl")] jobs jobs)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobs).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(jobs));
 }
Пример #6
0
 public ActionResult Edit([Bind(Include = "title_id,lorange,hirange,royalty")] roysched roysched)
 {
     if (ModelState.IsValid)
     {
         db.Entry(roysched).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.title_id = new SelectList(db.titles, "title_id", "title1", roysched.title_id);
     return View(roysched);
 }
 public ActionResult Edit([Bind(Include = "discounttype,stor_id,lowqty,highqty,discount1")] discount discount)
 {
     if (ModelState.IsValid)
     {
         db.Entry(discount).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.stor_id = new SelectList(db.stores, "stor_id", "stor_name", discount.stor_id);
     return(View(discount));
 }
 public ActionResult Edit([Bind(Include = "au_id,title_id,au_ord,royaltyper")] titleauthor titleauthor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(titleauthor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.au_id    = new SelectList(db.authors, "au_id", "au_lname", titleauthor.au_id);
     ViewBag.title_id = new SelectList(db.titles, "title_id", "title1", titleauthor.title_id);
     return(View(titleauthor));
 }
Пример #9
0
 public ActionResult Edit([Bind(Include = "emp_id,fname,minit,lname,job_id,job_lvl,pub_id,hire_date")] employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.job_id = new SelectList(db.jobs, "job_id", "job_desc", employee.job_id);
     ViewBag.pub_id = new SelectList(db.publishers, "pub_id", "pub_name", employee.pub_id);
     return(View(employee));
 }
Пример #10
0
 public ActionResult Edit([Bind(Include = "title_id,title1,type,pub_id,price,advance,royalty,ytd_sales,notes,pubdate")] title title)
 {
     if (ModelState.IsValid)
     {
         db.Entry(title).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.pub_id   = new SelectList(db.publishers, "pub_id", "pub_name", title.pub_id);
     ViewBag.title_id = new SelectList(db.royscheds, "title_id", "title_id", title.title_id);
     return(View(title));
 }
Пример #11
0
 public ActionResult Edit([Bind(Include = "stor_id,ord_num,ord_date,qty,payterms,title_id")] sales sales)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sales).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.stor_id  = new SelectList(db.stores, "stor_id", "stor_name", sales.stor_id);
     ViewBag.title_id = new SelectList(db.titles, "title_id", "title", sales.title_id);
     return(View(sales));
 }
Пример #12
0
 public ActionResult Edit([Bind(Include = "job_id,job_desc,min_lvl,max_lvl")] job job)
 {
     if (ModelState.IsValid)
     {
         db.Entry(job).State = EntityState.Modified;
         db.SaveChanges();
         TempData["message_css"] = "alert alert-success";
         TempData["message"]     = "Successful";
         return(RedirectToAction("Index"));
     }
     TempData["message_css"] = "alert alert-danger";
     TempData["message"]     = "Invalid input";
     return(View(job));
 }
Пример #13
0
 public ActionResult Edit([Bind(Include = "au_id,au_lname,au_fname,phone,address,city,state,zip,contract")] author author)
 {
     if (ModelState.IsValid)
     {
         db.Entry(author).State = EntityState.Modified;
         db.SaveChanges();
         TempData["message_css"] = "alert alert-success";
         TempData["message"]     = "Sucessful";
         return(RedirectToAction("Index"));
     }
     TempData["message_css"] = "alert alert-danger";
     TempData["message"]     = "Invalid input";
     return(View(author));
 }
Пример #14
0
 public ActionResult Edit([Bind(Include = "stor_id,stor_name,stor_address,city,state,zip")] store store)
 {
     if (ModelState.IsValid)
     {
         db.Entry(store).State = EntityState.Modified;
         db.SaveChanges();
         TempData["message_css"] = "alert alert-successful";
         TempData["message"]     = "Successful";
         return(RedirectToAction("Index"));
     }
     TempData["message_css"] = "alert alert-danger";
     TempData["message"]     = "Invalid input";
     return(View(store));
 }
Пример #15
0
 public ActionResult Edit([Bind(Include = "pub_id,pub_name,city,state,country")] publisher publisher)
 {
     if (ModelState.IsValid)
     {
         db.Entry(publisher).State = EntityState.Modified;
         db.SaveChanges();
         TempData["message_css"] = "alert alert-success";
         TempData["message"]     = "Successful";
         return(RedirectToAction("Index"));
     }
     ViewBag.pub_id          = new SelectList(db.pub_info, "pub_id", "pr_info", publisher.pub_id);
     TempData["message_css"] = "alert alert-danger";
     TempData["message"]     = "Invalid input";
     return(View(publisher));
 }
Пример #16
0
 public ActionResult Edit([Bind(Include = "emp_id,fname,minit,lname,job_id,job_lvl,pub_id,hire_date")] employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         TempData["message_css"] = "alert alert-success";
         TempData["message"]     = "Successful";
         return(RedirectToAction("Index"));
     }
     ViewBag.job_id          = new SelectList(db.jobs, "job_id", "job_desc", employee.job_id);
     ViewBag.pub_id          = new SelectList(db.publishers, "pub_id", "pub_name", employee.pub_id);
     TempData["message_css"] = "alert alert-danger";
     TempData["message"]     = "Invalid input";
     return(View(employee));
 }
Пример #17
0
 public ActionResult Edit([Bind(Include = "stor_id,ord_num,ord_date,qty,payterms,title_id")] sale sale)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sale).State = EntityState.Modified;
         db.SaveChanges();
         TempData["message_css"] = "alert alert-success";
         TempData["message"]     = "Successful";
         return(RedirectToAction("Index"));
     }
     ViewBag.stor_id         = new SelectList(db.stores, "stor_id", "stor_name", sale.stor_id);
     ViewBag.title_id        = new SelectList(db.titles, "title_id", "title1", sale.title_id);
     TempData["message_css"] = "alert alert-danger";
     TempData["message"]     = "Invalid input";
     return(View(sale));
 }
Пример #18
0
 public ActionResult Edit([Bind(Include = "job_id,job_desc,min_lvl,max_lvl")] job job)
 {
     if (ModelState.IsValid)
     {
         db.Entry(job).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             return(RedirectToAction("../Home/Error"));
         }
         return(RedirectToAction("Index"));
     }
     return(View(job));
 }
Пример #19
0
 public ActionResult Edit([Bind(Include = "au_id,au_lname,au_fname,phone,address,city,state,zip,contract")] author author)
 {
     if (ModelState.IsValid)
     {
         db.Entry(author).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             return(RedirectToAction("../Home/Error"));
         }
         return(RedirectToAction("Index"));
     }
     return(View(author));
 }
Пример #20
0
 public ActionResult Edit([Bind(Include = "pub_id,pub_name,city,state,country")] publisher publisher)
 {
     if (ModelState.IsValid)
     {
         db.Entry(publisher).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             return(RedirectToAction("../Home/Error"));
         }
         return(RedirectToAction("Index"));
     }
     ViewBag.pub_id = new SelectList(db.pub_info, "pub_id", "pr_info", publisher.pub_id);
     return(View(publisher));
 }
 public ActionResult Edit([Bind(Include = "title_id,lorange,hirange,royalty")] roysched roysched)
 {
     if (ModelState.IsValid)
     {
         db.Entry(roysched).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             return(RedirectToAction("../Home/Error"));
         }
         return(RedirectToAction("Index"));
     }
     ViewBag.title_id = new SelectList(db.titles, "title_id", "title1", roysched.title_id);
     return(View(roysched));
 }
Пример #22
0
 public ActionResult Edit([Bind(Include = "stor_id,ord_num,ord_date,qty,payterms,title_id")] sale sale)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sale).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             return(RedirectToAction("../Home/Error"));
         }
         return(RedirectToAction("Index"));
     }
     ViewBag.stor_id  = new SelectList(db.stores, "stor_id", "stor_name", sale.stor_id);
     ViewBag.title_id = new SelectList(db.titles, "title_id", "title1", sale.title_id);
     ViewBag.ord_num  = new SelectList(db.sales, "ord_num", "ord_num", sale.ord_num);
     return(View(sale));
 }