public EggProduction Get(Guid id)
        {
            var production = service.Get(id);

            if (production == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            return(production);
        }
        void OnLoad(object param)
        {
            var loadedData = service.Get((Guid)param);

            Id   = loadedData.Id;
            Date = loadedData.Date.Date;

            var loadedDatails = Mapper.Map <List <Models.EggProductionDetail>, List <EggProductionDetailViewModel> >(loadedData.Details);

            Details = new ObservableCollection <EggProductionDetailViewModel>(loadedDatails);

            RefreshConsumption(null);
        }
        public void Can_GetById()
        {
            var id = Guid.NewGuid();

            var house = new Models.HenHouse
            {
                Id           = Guid.NewGuid(),
                Name         = "House 1",
                PurchaseCost = 1,
                Depreciation = 1,
                YearUsage    = 1,
                Active       = true
            };


            var data = new Models.Data.EggProduction
            {
                Id   = id,
                Date = DateTime.Today
            };
            var detail = new Models.Data.EggProductionDetail
            {
                CrackedEggCount = 1,
                Fcr             = 1,
                GoodEggCount    = 1,
                HouseId         = house.Id,
                ProductionId    = id,
                RetailQuantity  = 1.2m
            };

            using (var conn = factory.OpenDbConnection())
            {
                conn.InsertParam(house);
                conn.InsertParam(data);
                conn.InsertParam(detail);
            }

            var production = service.Get(id);

            Compare(data, null, production);
        }