public JsonResult _InsertBirthHistory(BirthHistory ins) { ins = aiRep.InsertBirthHistory(ins); if ((ins.HistoryId != 0) && (ins.ChildId != 0)) { AnimalRelationship father = new AnimalRelationship(); father.ParentAnimalId = ins.MaleParentId; father.ChildAnimalId = ins.ChildId; father = animalRep.InsertAnimalRelationship(father); AnimalRelationship mother = new AnimalRelationship(); mother.ParentAnimalId = ins.FemaleParentId; mother.ChildAnimalId = ins.ChildId; mother = animalRep.InsertAnimalRelationship(mother); } return(Json(new GridModel(commonRep.GetBirthHistories()))); }