public ActionResult Edit(TermsOfDelivery termsofdelivery)
 {
     if (ModelState.IsValid)
     {
         db.Entry(termsofdelivery).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(termsofdelivery);
 }
        public ActionResult Create(TermsOfDelivery termsofdelivery)
        {
            ModelState.Remove("todNo");
            if (ModelState.IsValid)
            {
                // generate new TermsOfDelivery id
                var lastId = db.TermsOfDeliveries.Max(items => items.todNo);
                var newId = lastId + 1;
                termsofdelivery.todNo = newId; 
                db.TermsOfDeliveries.Add(termsofdelivery);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(termsofdelivery);
        }