public void POSTUpdateIsPopulation()
        {
            var aivm = new AccessionIndexViewModel
            {
                Id           = 12,
                FamilyId     = 13,
                IsPopulation = false
            };
            var genotype = new Genotype
            {
                Id           = 12,
                FamilyId     = 13,
                IsPopulation = true
            };
            var family = new Family
            {
                Id        = 13,
                Genotypes =
                {
                    genotype
                }
            };
            var mockRepo = new Mock <IPlantBreedingRepo>();

            mockRepo.Setup(m => m.GetGenotype(12)).Returns(genotype);
            mockRepo.Setup(m => m.GetFamily(13)).Returns(family);
            var     controller = new DefaultController(mockRepo.Object);
            var     response   = controller.UpdateIsPopulation(aivm) as JsonResult;
            dynamic json       = response.Data;

            Assert.IsNotNull(response);
            Assert.IsFalse(json.Error);
            Assert.AreEqual(json.Message, String.Empty);
        }
        public ActionResult UpdateIsPopulation(AccessionIndexViewModel aivm)
        {
            bool   error   = false;
            string message = string.Empty;

            try
            {
                a_repo.UpdateGenotypeIsPopulation(aivm.Id, aivm.IsPopulation);
            }
            catch (AccessionException e)
            {
                error   = true;
                message = e.Message;
            }

            return(Json(new { Error = error, Message = message }));
        }