public EmployeeCost Get(Guid id)
        {
            var cost = service.Get(id);

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

            return(cost);
        }
        public void Can_GetById()
        {
            Models.Data.EmployeeCost costData;
            var id      = Guid.NewGuid();
            var details = new List <Models.Data.EmployeeCostDetail>();

            using (var conn = factory.OpenDbConnection())
            {
                costData = new Models.Data.EmployeeCost
                {
                    Id    = id,
                    Date  = DateTime.Today,
                    Total = 100000
                };

                conn.InsertParam(costData);


                for (int i = 0; i < 2; i++)
                {
                    var employee = new Employee
                    {
                        Active = true,
                        Id     = Guid.NewGuid(),
                        Name   = "Employee-" + i,
                        Salary = 50000
                    };

                    conn.InsertParam(employee);

                    var detail = new Models.Data.EmployeeCostDetail();
                    detail.CostId      = id;
                    detail.Description = "Desc" + i;
                    detail.Present     = true;
                    detail.Salary      = 50000;
                    detail.EmployeeId  = employee.Id;

                    conn.InsertParam(detail);
                    details.Add(detail);
                }
            }

            var cost = service.Get(id);

            Compare(costData, details, cost);
        }
        void OnLoadCost(object param)
        {
            var loadedCost = costService.Get((Guid)param);

            Id    = loadedCost.Id;
            Total = loadedCost.Total;
            Date  = loadedCost.Date.Date;

            var loadedDatails = Mapper.Map <List <Models.EmployeeCostDetail>, List <EmployeeCostDetailViewModel> >(loadedCost.Details);

            if (loadedDatails != null)
            {
                foreach (var loadedDetail in loadedDatails)
                {
                    loadedDetail.PropertyChanged += detail_PropertyChanged;
                }
            }

            Details = new ObservableCollection <EmployeeCostDetailViewModel>(loadedDatails);
        }