public ActionResult Delete(int id) { var animals=new AnimalBusiness(); ViewBag.Batchtypeid = new SelectList(_db2.GetAllBatchTypes(), "BatchTypeid", "BatchTypeDesc"); var anView =ani.GetAnimalById(id); ani.DeleteAnimals(anView); dead.InsertDeadAnimals(anView); return RedirectToAction("GetAllAnimals"); }
//Method to get number of animals currently in feeding lots private static int CalcAniFeeding(FeedingSchemeView model) { AnimalBusiness aniBl = new AnimalBusiness(); BatchTypeBl batchTypeBl = new BatchTypeBl(); var bDesc = batchTypeBl.GetAllBatchTypes().Find(x => x.BatchTypeid == model.BatchTypeid); return(aniBl.GetAllAnimals().Count(animalpar => animalpar.AniFeedingStatus == "FeedLot" && animalpar.BatchTypeDesc == bDesc.BatchTypeDesc)); }
//Method to get number of animals currently in feeding lots private static int CalcAniFeeding(FeedingSchemeView model) { AnimalBusiness aniBl = new AnimalBusiness(); BatchTypeBl batchTypeBl = new BatchTypeBl(); var bDesc = batchTypeBl.GetAllBatchTypes().Find(x=>x.BatchTypeid== model.BatchTypeid); return (aniBl.GetAllAnimals().Count(animalpar => animalpar.AniFeedingStatus == "FeedLot" && animalpar.BatchTypeDesc==bDesc.BatchTypeDesc)); }