public ActionResult CatEdit(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CatVetting catVetting = db.CatVettings.Find(id); catVetting.TempVettingDecimal = 0; catVetting.ReasonForVisit = String.Empty; if (catVetting == null) { return(HttpNotFound()); } ViewBag.AnimalId = new SelectList(db.Animals.Where(e => e.AnimalTypeID == 0).Where(e => e.Adopted == false), "id", "Name", catVetting.AnimalId); ViewBag.DewormerLocationId = new SelectList(db.Locations.Where(e => e.isBasicVaxLocation).OrderBy(e => e.isShowLast).ThenBy(e => e.name), "id", "name", catVetting.DewormerLocationId); ViewBag.FleaTickLocationId = new SelectList(db.Locations.Where(e => e.isBasicVaxLocation).OrderBy(e => e.isShowLast).ThenBy(e => e.name), "id", "name", catVetting.FleaTickLocationId); ViewBag.FVRCP1LocationId = new SelectList(db.Locations.Where(e => e.isBasicVaxLocation).OrderBy(e => e.isShowLast).ThenBy(e => e.name), "id", "name", catVetting.FVRCP1LocationId); ViewBag.FVRCP2LocationId = new SelectList(db.Locations.Where(e => e.isBasicVaxLocation).OrderBy(e => e.isShowLast).ThenBy(e => e.name), "id", "name", catVetting.FVRCP2LocationId); ViewBag.FVRCP3LocationId = new SelectList(db.Locations.Where(e => e.isBasicVaxLocation).OrderBy(e => e.isShowLast).ThenBy(e => e.name), "id", "name", catVetting.FVRCP3LocationId); ViewBag.MicrochipLocationId = new SelectList(db.Locations.Where(e => e.isBasicVaxLocation).OrderBy(e => e.isShowLast).ThenBy(e => e.name), "id", "name", catVetting.MicrochipLocationId); ViewBag.RabiesLocationId = new SelectList(db.Locations.Where(e => e.isRabiesVaxLocation).OrderBy(e => e.isShowLast).ThenBy(e => e.name), "id", "name", catVetting.RabiesLocationId); ViewBag.SterilizationLocationId = new SelectList(db.Locations.Where(e => e.isRabiesVaxLocation).OrderBy(e => e.isShowLast).ThenBy(e => e.name), "id", "name", catVetting.SterilizationLocationId); ViewBag.MicrochipManufacturerId = new SelectList(db.Medications.Where(e => e.isMicrochipManufacturer).OrderBy(e => e.Name), "id", "name", catVetting.MicrochipManufacturerId); return(View(catVetting)); }
public ActionResult CreateCat(CatVetting catVetting) { if (ModelState.IsValid) { if (catVetting.TempVettingDecimal != 0) { var eE = new ExpenseEntry(); catVetting.Animal = db.Animals.Find(catVetting.AnimalId); eE.VetBillsDecimal = catVetting.TempVettingDecimal; eE.VetBillsComment = catVetting.Animal.name + " - " + catVetting.ReasonForVisit; eE.AccountTypeID = 0; eE.EffectiveDate = (catVetting.VetDiagnosisDate == null) ? DateTime.Today : catVetting.VetDiagnosisDate; catVetting.VettingTotalDecimal += catVetting.TempVettingDecimal; catVetting.Animal.VettingTotalDecimal = catVetting.VettingTotalDecimal; db.ExpenseEntries.Add(eE); db.SaveChanges(); } db.CatVettings.Add(catVetting); db.SaveChanges(); return(RedirectToAction("CatIndex")); } //return View(dogVetting); return(RedirectToAction("CatIndex", "Vettings")); }
public ActionResult DeleteConfirmed(short id) { CatVetting catVetting = db.CatVettings.Find(id); db.CatVettings.Remove(catVetting); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult CatDetails(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CatVetting catVetting = db.CatVettings.Find(id); if (catVetting == null) { return(HttpNotFound()); } return(View(catVetting)); }
public ActionResult CreateCat() { var catVetting = new CatVetting { TempVettingDecimal = 0 }; var viewModel = new NewCatVettingViewModel { Meds = db.Medications.Where(e => e.isForCats).ToList(), RabiesLocations = rabiesLocations, BasicVaxLocations = locations, Animals = cats, MicrochipManufactures = microchipManufactures, CatVetting = catVetting }; return(View(viewModel)); }
public ActionResult Edit([Bind(Include = "id,AnimalId,MicrochipNumber,MicrochipLocationId,MicrochipManufacturerId,Sterilized,SterilizationDate,SterilizationLocationId,Rabies,RabiesDate,RabiesLocationId,FVRCP1,FVRCP1Date,FVRCP1LocationId,FVRCP2,FVRCP2Date,FVRCP2LocationId,FVRCP3,FVRCP3Date,FVRCP3LocationId,FVRCP3Due,DewormerDate,DewormerLocationId,FleaTickDate,FleaTickLocationId,FEVLeukTested,FEVLeukDate,FEVLeukId,FEVLeukResult,AddtlVetting,VetDiagnosis,VetDiagnosisDate,MedicationsGiven,NextVet,VettingCompleted,AdtlComments")] CatVetting catVetting) { if (ModelState.IsValid) { db.Entry(catVetting).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AnimalId = new SelectList(db.Animals, "id", "MCARId", catVetting.AnimalId); ViewBag.DewormerLocationId = new SelectList(db.Locations, "id", "name", catVetting.DewormerLocationId); ViewBag.FleaTickLocationId = new SelectList(db.Locations, "id", "name", catVetting.FleaTickLocationId); ViewBag.FVRCP1LocationId = new SelectList(db.Locations, "id", "name", catVetting.FVRCP1LocationId); ViewBag.FVRCP2LocationId = new SelectList(db.Locations, "id", "name", catVetting.FVRCP2LocationId); ViewBag.FVRCP3LocationId = new SelectList(db.Locations, "id", "name", catVetting.FVRCP3LocationId); ViewBag.MicrochipLocationId = new SelectList(db.Locations, "id", "name", catVetting.MicrochipLocationId); ViewBag.RabiesLocationId = new SelectList(db.Locations, "id", "name", catVetting.RabiesLocationId); ViewBag.SterilizationLocationId = new SelectList(db.Locations, "id", "name", catVetting.SterilizationLocationId); return(View(catVetting)); }
public ActionResult CatEdit(CatVetting catVetting) { if (ModelState.IsValid) { if (catVetting.TempVettingDecimal != 0) { var eE = new ExpenseEntry(); catVetting.Animal = db.Animals.Find(catVetting.AnimalId); eE.VetBillsDecimal = catVetting.TempVettingDecimal; eE.VetBillsComment = catVetting.Animal.name + " - " + catVetting.ReasonForVisit; eE.AccountTypeID = 0; eE.EffectiveDate = (catVetting.VetDiagnosisDate == null) ? DateTime.Today : catVetting.VetDiagnosisDate; catVetting.VettingTotalDecimal += catVetting.TempVettingDecimal; catVetting.Animal.VettingTotalDecimal = catVetting.VettingTotalDecimal; db.ExpenseEntries.Add(eE); db.SaveChanges(); } db.Entry(catVetting).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("CatIndex")); } ViewBag.AnimalId = new SelectList(db.Animals.Where(e => e.AnimalTypeID == 0).Where(e => e.Adopted == false), "id", "Name", catVetting.AnimalId); ViewBag.DewormerLocationId = new SelectList(db.Locations, "id", "name", catVetting.DewormerLocationId); ViewBag.FleaTickLocationId = new SelectList(db.Locations, "id", "name", catVetting.FleaTickLocationId); ViewBag.FVRCP1LocationId = new SelectList(db.Locations, "id", "name", catVetting.FVRCP1LocationId); ViewBag.FVRCP2LocationId = new SelectList(db.Locations, "id", "name", catVetting.FVRCP2LocationId); ViewBag.FVRCP3LocationId = new SelectList(db.Locations, "id", "name", catVetting.FVRCP3LocationId); ViewBag.MicrochipLocationId = new SelectList(db.Locations, "id", "name", catVetting.MicrochipLocationId); ViewBag.RabiesLocationId = new SelectList(db.Locations, "id", "name", catVetting.RabiesLocationId); ViewBag.SterilizationLocationId = new SelectList(db.Locations, "id", "name", catVetting.SterilizationLocationId); ViewBag.MicrochipManufacturerId = new SelectList(db.Medications.Where(e => e.isMicrochipManufacturer).OrderBy(e => e.Name), "id", "name", catVetting.MicrochipManufacturerId); return(View(catVetting)); }
// GET: CatVettingsControllerTEMP/Edit/5 public ActionResult Edit(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CatVetting catVetting = db.CatVettings.Find(id); if (catVetting == null) { return(HttpNotFound()); } ViewBag.AnimalId = new SelectList(db.Animals, "id", "MCARId", catVetting.AnimalId); ViewBag.DewormerLocationId = new SelectList(db.Locations, "id", "name", catVetting.DewormerLocationId); ViewBag.FleaTickLocationId = new SelectList(db.Locations, "id", "name", catVetting.FleaTickLocationId); ViewBag.FVRCP1LocationId = new SelectList(db.Locations, "id", "name", catVetting.FVRCP1LocationId); ViewBag.FVRCP2LocationId = new SelectList(db.Locations, "id", "name", catVetting.FVRCP2LocationId); ViewBag.FVRCP3LocationId = new SelectList(db.Locations, "id", "name", catVetting.FVRCP3LocationId); ViewBag.MicrochipLocationId = new SelectList(db.Locations, "id", "name", catVetting.MicrochipLocationId); ViewBag.RabiesLocationId = new SelectList(db.Locations, "id", "name", catVetting.RabiesLocationId); ViewBag.SterilizationLocationId = new SelectList(db.Locations, "id", "name", catVetting.SterilizationLocationId); return(View(catVetting)); }