public ActionResult DeleteConfirmed(int id) { FisCategory fisCategory = db.FisCategories.Find(id); db.FisCategories.Remove(fisCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name")] FisCategory fisCategory) { if (ModelState.IsValid) { db.Entry(fisCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fisCategory)); }
public ActionResult Create([Bind(Include = "Id,Name")] FisCategory fisCategory) { if (ModelState.IsValid) { db.FisCategories.Add(fisCategory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fisCategory)); }
// GET: FisCategories/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FisCategory fisCategory = db.FisCategories.Find(id); if (fisCategory == null) { return(HttpNotFound()); } return(View(fisCategory)); }
public static void InitializeApplicationData(ApplicationDbContext db) { //Discrepancy Types var discrepancyTypes = new List <DiscrepancyType> { new DiscrepancyType { Name = "OS&D" }, new DiscrepancyType { Name = "Wrong Material" }, new DiscrepancyType { Name = "Testing Failure" }, new DiscrepancyType { Name = "Weld Quality" }, new DiscrepancyType { Name = "Fitting Error" } }; foreach (var temp in discrepancyTypes) { db.DiscrepancyTypes.Add(temp); } //Business Areas var businessAreas = new List <BusinessArea> { new BusinessArea { Name = "Project Planning" }, new BusinessArea { Name = "Project Management" }, new BusinessArea { Name = "Project Cost Control" }, new BusinessArea { Name = "Drafting" }, new BusinessArea { Name = "Engineering" }, new BusinessArea { Name = "Shop Detailing" }, new BusinessArea { Name = "Shop Fitting" }, new BusinessArea { Name = "Shop Welding" }, new BusinessArea { Name = "Shop Paint" }, new BusinessArea { Name = "Shop Hse" }, new BusinessArea { Name = "Shop Qc" }, new BusinessArea { Name = "Shipping/Receiving" }, new BusinessArea { Name = "Operations Management" }, new BusinessArea { Name = "Accounts Receivable" }, new BusinessArea { Name = "Accounts Payable" }, new BusinessArea { Name = "Payroll" }, new BusinessArea { Name = "Field Admin" }, new BusinessArea { Name = "Field Workface" }, new BusinessArea { Name = "Field Hse" }, new BusinessArea { Name = "Field Qc" }, new BusinessArea { Name = "Information Systems" } }; foreach (var temp in businessAreas) { db.BusinessAreas.Add(temp); } var dispositionTypes = new List <DispositionType> { new DispositionType { Name = "Rework" }, new DispositionType { Name = "Use As Is" }, new DispositionType { Name = "Scrap" }, new DispositionType { Name = "Remake" }, new DispositionType { Name = "Return To Vendor" } }; foreach (var temp in dispositionTypes) { db.DispositionTypes.Add(temp); } //FIS Categories and Codes var fisCategories = new List <FisCategory> { }; var category1 = new FisCategory { Name = "Category 1" }; fisCategories.Add(category1); var category2 = new FisCategory { Name = "Category 2" }; fisCategories.Add(category2); var category3 = new FisCategory { Name = "Category 3" }; fisCategories.Add(category3); foreach (var temp in fisCategories) { db.FisCategories.Add(temp); } var fisCategoryCodes = new List <FisCode> { new FisCode { FisCategory = category1, CodeName = "Code1" }, new FisCode { FisCategory = category1, CodeName = "Code2" }, new FisCode { FisCategory = category1, CodeName = "Code3" }, new FisCode { FisCategory = category2, CodeName = "Code4" }, new FisCode { FisCategory = category2, CodeName = "Code5" }, new FisCode { FisCategory = category2, CodeName = "Code6" }, new FisCode { FisCategory = category2, CodeName = "Code7" }, new FisCode { FisCategory = category3, CodeName = "Code8" }, new FisCode { FisCategory = category3, CodeName = "Code9" } }; foreach (var temp in fisCategoryCodes) { db.FisCodes.Add(temp); } db.SaveChanges(); }