public IActionResult GetNutrition(string pregnancyStatus, string milkStatus, string speciesId, string milkVolumn, string fat, string animalWeight)
        {
            GeneralNutration       gn       = _repo.GeneralNutrition.GetByWeight(animalWeight, speciesId);
            MIlkBaseNutrition      mn       = _repo.MilkBase.GetByFat(fat, int.Parse(speciesId));
            PregnancyBaseNutrition pn       = _repo.PregnancyBaseNutrition.GetModel().FirstOrDefault(m => m.weight == animalWeight && m.speciesId == int.Parse(speciesId) && m.PregrenencyType == pregnancyStatus);
            requiredNutrients      required = new requiredNutrients();

            required.dm  = (gn.dm ?? "0");
            required.snf = (gn.snf ?? "0");
            required.tdn = (gn.tdn ?? "0");
            required.c   = (gn.c ?? "0");
            required.p   = (gn.p ?? "0");
            if (gn != null)
            {
                required.dm  = gn.dm;
                required.snf = gn.snf;
                required.tdn = gn.tdn;
                required.c   = gn.c;
                required.p   = gn.p;
            }

            if (mn != null)
            {
                required.dm  = (Convert.ToDecimal(required.dm) + Convert.ToDecimal(mn.dm)).ToString();
                required.snf = (Convert.ToDecimal(required.snf) + Convert.ToDecimal(mn.snf)).ToString();
                required.tdn = (Convert.ToDecimal(required.tdn) + Convert.ToDecimal(mn.tdn)).ToString();
                required.c   = (Convert.ToDecimal(required.c) + Convert.ToDecimal(mn.c)).ToString();
                required.p   = (Convert.ToDecimal(required.p) + Convert.ToDecimal(mn.p)).ToString();
            }

            if (pn != null)
            {
                required.dm  = (Convert.ToDecimal(required.dm) + Convert.ToDecimal(pn.dm)).ToString();
                required.snf = (Convert.ToDecimal(required.snf) + Convert.ToDecimal(pn.snf)).ToString();
                required.tdn = (Convert.ToDecimal(required.tdn) + Convert.ToDecimal(pn.tdn)).ToString();
                required.c   = (Convert.ToDecimal(required.c) + Convert.ToDecimal(pn.c)).ToString();
                required.p   = (Convert.ToDecimal(required.p) + Convert.ToDecimal(pn.p)).ToString();
            }
            if ((milkVolumn ?? "0") == "0")
            {
                milkVolumn = "1";
            }
            {
                required.dm  = (Convert.ToDecimal(required.dm) * Convert.ToDecimal(milkVolumn)).ToString();
                required.snf = (Convert.ToDecimal(required.snf) * Convert.ToDecimal(milkVolumn)).ToString();
                required.tdn = (Convert.ToDecimal(required.tdn) * Convert.ToDecimal(milkVolumn)).ToString();
                required.c   = (Convert.ToDecimal(required.c) * Convert.ToDecimal(milkVolumn) * Convert.ToDecimal(1000)).ToString();
                required.p   = (Convert.ToDecimal(required.p) * Convert.ToDecimal(milkVolumn) * Convert.ToDecimal(1000)).ToString();
            }
            return(Json(required));
        }
        public IActionResult GetMilkBaseNutrient(string pregnancyStatus, string milkStatus, string speciesId, string milkVolumn, string fat, string animalWeight)
        {
            //GeneralNutration gn = _repo.GeneralNutrition.GetByWeight(animalWeight, speciesId);
            MIlkBaseNutrition mn = _repo.MilkBase.GetByFat(fat, int.Parse(speciesId));
            //PregnancyBaseNutrition pn = _repo.PregnancyBaseNutrition.GetModel().FirstOrDefault(m => m.weight == animalWeight && m.speciesId == int.Parse(speciesId) && m.PregrenencyType == pregnancyStatus);
            requiredNutrients required = new requiredNutrients();

            //required.dm = (gn.dm ?? "0");
            //required.snf = (gn.snf ?? "0");
            //required.tdn = (gn.tdn ?? "0");
            //required.c = (gn.c ?? "0");
            //required.p = (gn.p ?? "0");
            //if (gn != null)
            //{
            //    required.dm = gn.dm;
            //    required.snf = gn.snf;
            //    required.tdn = gn.tdn;
            //    required.c = gn.c;
            //    required.p = gn.p;
            //}

            if (mn != null)
            {
                string[] res = CalculateDm(animalWeight, pregnancyStatus, milkVolumn);
                required.dm      = res[0];
                required.snf     = (Convert.ToDecimal(mn.snf)).ToString();
                required.tdn     = (Convert.ToDecimal(mn.tdn)).ToString();
                required.c       = (Convert.ToDecimal(mn.c)).ToString();
                required.p       = (Convert.ToDecimal(mn.p)).ToString();
                required.message = res[1];
            }


            //if ((milkVolumn ?? "0") == "0")
            //{
            //    milkVolumn = "10";
            //}
            //{
            //    required.dm = (Convert.ToDecimal(required.dm)).ToString();
            //    required.snf = (Convert.ToDecimal(required.snf)).ToString();
            //    required.tdn = (Convert.ToDecimal(required.tdn) ).ToString();
            //    required.c = (Convert.ToDecimal(required.c)).ToString();
            //    required.p = (Convert.ToDecimal(required.p)).ToString();

            //}
            return(Json(required));
        }