public ActionResult DeleteConfirmed(StatusCreateModel model) { Bundle bundle = null; string[] statuses = { "ordered", "inforeignstock", "ontheway", "arrived", "delivered" }; if (ModelState.IsValid && statuses.Contains(model.Name)) { bundle = db.bundles.FirstOrDefault(f => f.Id == model.Bundle); bundle.deleteStatus(new Status { Name = model.Name, CreatedDate = model.CreateDate }); db.SaveChanges(); } return(RedirectToAction("AdminDetails", "Bundle", new { id = model.Bundle })); }
public ActionResult Create(StatusCreateModel model) { Bundle bundle = null; // bilirem bu duzgun deyil.... amma indi bununla bagli duzelis elemek istesem cox yerde deyisiklik elemeliyem // ona gore helelik bununla yola verirem... string[] statuses = { "inforeignstock", "ontheway", "arrived", "delivered" }; if (ModelState.IsValid && statuses.Contains(model.Name)) { bundle = db.bundles.FirstOrDefault(f => f.Id == model.Bundle); bundle.addStatus(new Status { Name = model.Name, CreatedDate = model.CreateDate }); db.SaveChanges(); } return(RedirectToAction("AdminDetails", "Bundle", new { id = model.Bundle })); }