Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }