public ActionResult Create(VaccinationDefinition Vaccination)
 {
     ViewBag.CurrentPage = "Vaccination";
     Vaccination.Age = db.Ages.FirstOrDefault(p => p.Code == Vaccination.Age.Code);
     try
     {
         if (ModelState.IsValid)
         {
             Vaccination.Id = Guid.NewGuid();
             VaccinationDefinition resultObj =  db.VaccinationDefinitions.Add(Vaccination);
             db.SaveChanges();
             DataAccessLayer.VaccincationPriceDal provider = new VaccincationPriceDal();
             provider.AddVaccinationPrice(Vaccination.Id.ToString(), (Decimal) 0.0, true);
             return RedirectToAction("Index");
         }
     }
     catch (RetryLimitExceededException /* dex */)
     {
         //Log the error (uncomment dex variable name and add a line here to write a log.)
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
     }
     PopulateVaccinationDefinitionDropDownList(Vaccination.Id);
     return View(Vaccination);
 }
        public ActionResult EditPost(VaccinationDefinition vaccDefinition)
        {
            ViewBag.CurrentPage = "Vaccination";
            if (vaccDefinition == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            if (ModelState.IsValid)
            {
                //public string Code { get; set; }
                //public string Name { get; set; }
                //public virtual Age Age { get; set; }
                //public string Description { get; set; }
                //public string ICDCode { get; set; }
                //public decimal? Price { get; set; } = (decimal)0.00;
                var obj = db.VaccinationDefinitions.FirstOrDefault(x => x.Id == vaccDefinition.Id);
                obj.Code = vaccDefinition.Code;
                obj.Name = vaccDefinition.Name;
                obj.Age = db.Ages.FirstOrDefault(x=>x.Code == vaccDefinition.Age.Code);
                obj.Description = vaccDefinition.Description;
                obj.ICDCode = vaccDefinition.ICDCode;
                obj.Price = vaccDefinition.Price;
                //db.Entry(vaccDefinition).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(vaccDefinition);
            //var VaccinationToUpdate = db.VaccinationDefinitions.Find(id);
            //if (TryUpdateModel(VaccinationToUpdate, "",
            //   new string[] { "Title", "Credits", "DepartmentID" }))
            //{
            //    try
            //    {
            //        db.Entry(VaccinationToUpdate).State = EntityState.Modified;
            //        db.SaveChanges();

            //        return RedirectToAction("Index");
            //    }
            //    catch (RetryLimitExceededException /* dex */)
            //    {
            //        //Log the error (uncomment dex variable name and add a line here to write a log.
            //        ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
            //    }
            //}
            //PopulateVaccinationDefinitionDropDownList(VaccinationToUpdate.Id);
            //return View(VaccinationToUpdate);
        }