Ejemplo n.º 1
0
        /// <summary>
        /// Adds the employee.
        /// </summary>
        /// <param name="employee">The employee.</param>
        /// <returns></returns>
        public EmployeeDataDto AddEmployee(EmployeeDataDto employee)
        {
            var added = AsEmployeeService.AddEmployee(employee.ToEntity());

            if (added != null)
            {
                return(added.ToDTO());
            }
            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts this instance of <see cref="EmployeeData"/> to an instance of <see cref="EmployeeDataDto"/>.
        /// </summary>
        /// <param name="entity"><see cref="EmployeeData"/> to convert.</param>
        public static EmployeeDataDto ToDTO(this EmployeeData entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new EmployeeDataDto();

            dto.Id        = entity.Id;
            dto.FirstName = entity.FirstName;
            dto.LastName  = entity.LastName;
            dto.DOB       = entity.DOB;

            entity.OnDTO(dto);

            return(dto);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts this instance of <see cref="EmployeeDataDto"/> to an instance of <see cref="EmployeeData"/>.
        /// </summary>
        /// <param name="dto"><see cref="EmployeeDataDto"/> to convert.</param>
        public static EmployeeData ToEntity(this EmployeeDataDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new EmployeeData();

            entity.Id        = dto.Id;
            entity.FirstName = dto.FirstName;
            entity.LastName  = dto.LastName;
            entity.DOB       = dto.DOB;

            dto.OnEntity(entity);

            return(entity);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Updates the specified employee.
 /// </summary>
 /// <param name="employee">The employee.</param>
 public void Update(EmployeeDataDto employee)
 {
     AsEmployeeService.Update(employee.ToEntity());
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="EmployeeData"/> converted from <see cref="EmployeeDataDto"/>.</param>
 static partial void OnEntity(this EmployeeDataDto dto, EmployeeData entity);
Ejemplo n.º 6
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="EmployeeDataDto"/> converted from <see cref="EmployeeData"/>.</param>
 static partial void OnDTO(this EmployeeData entity, EmployeeDataDto dto);