public DetentionDto GetDetentionById(int id)
        {
            if (id != default(int))
            {
                var detention = dataService.ExecProcGetModel <Detention>("GetDetentionById", new SqlParameter("@DetentionId", id));

                if (detention != null)
                {
                    var ReleaseEmpl = dataService.ExecProcGetModel <EmployeeDto>("GetEmployeeByExecutionProcedureID",
                                                                                 new SqlParameter("@ExecProcedureID", detention.ReleaseProceduresID),
                                                                                 new SqlParameter("@ExecuProcName", "Release"));

                    var DetainedEmpl = dataService.ExecProcGetModel <EmployeeDto>("GetEmployeeByExecutionProcedureID",
                                                                                  new SqlParameter("@ExecProcedureID", detention.DetentionProceduresID),
                                                                                  new SqlParameter("@ExecuProcName", "Detention"));

                    var DeliveredEmpl = dataService.ExecProcGetModel <EmployeeDto>("GetEmployeeByExecutionProcedureID",
                                                                                   new SqlParameter("@ExecProcedureID", detention.DeliveredProceduresID),
                                                                                   new SqlParameter("@ExecuProcName", "Delivery"));

                    var detentionDto = new DetentionDto()
                    {
                        DetentionID       = detention.DetentionID,
                        PrisonerID        = detention.PrisonerID,
                        PlaceofDetention  = detention.PlaceofDetention,
                        DateOfDetention   = detention.DateOfDetention,
                        DateOfArrival     = detention.DateOfArrival,
                        DateOfRelease     = detention.DateOfRelease,
                        AccruedAmount     = detention.AccruedAmount,
                        DeliveredEmployee = DeliveredEmpl,
                        DetainedEmployee  = DetainedEmpl,
                        ReleasedEmployee  = ReleaseEmpl,
                        PaidAmount        = detention.PaidAmount
                    };

                    return(detentionDto);
                }
            }
            return(default(DetentionDto));
        }
        public void EditDetention(DetentionDto detention)
        {
            if (detention != null)
            {
                var detentionEntity = new Detention()
                {
                    DetentionID      = detention.DetentionID,
                    AccruedAmount    = detention.AccruedAmount ?? default(decimal),
                    PaidAmount       = detention.PaidAmount ?? default(decimal),
                    DateOfArrival    = detention.DateOfArrival,
                    DateOfDetention  = detention.DateOfDetention,
                    DateOfRelease    = detention.DateOfRelease,
                    PlaceofDetention = detention.PlaceofDetention
                };
                dataService.ExecNonQuery("EditDetention", detentionEntity);

                dataService.ExecNonQuery("EditEmployee", detention.DeliveredEmployee);
                dataService.ExecNonQuery("EditEmployee", detention.DetainedEmployee);
                if (detention.ReleasedEmployee != null)
                {
                    dataService.ExecNonQuery("EditEmployee", detention.ReleasedEmployee);
                }
            }
        }
 public void EditDetention(DetentionDto detentionDto)
 {
     new PrisonerServiceClient()
     .Execute(client => client.EditDetention(detentionDto));
 }