Example #1
0
        public async Task <History> Add(History entity)
        {
            BLValidation.CheckHistory(entity);
            await  HasEmployeePosition(entity.EmployeeId);

            var history = await db.HistoryRepository.Add(mapper.Map <EmployeePosition>(entity));

            await db.Save();

            entity.Id = history.Id;
            return(entity);
        }
        public async Task <PositionDTO> Add(PositionDTO entity)
        {
            BLValidation.CheckPosition(entity);
            var exist = await IsPositionExist(entity);

            if (exist != null)
            {
                return(mapper.Map <PositionDTO>(exist));
            }
            var position = await db.PositionRepository.Add(mapper.Map <Position>(entity));

            await db.Save();

            entity.Id = position.Id;
            return(entity);
        }
Example #3
0
        public async Task <EmployeeDTO> Add(EmployeeDTO entity)
        {
            BLValidation.CheckEmployee(entity);
            var exist = await IsEmployeeExist(entity);

            if (exist != null)
            {
                return(mapper.Map <EmployeeDTO>(exist));
            }

            var model = await db.EmployeeRepository.Add(mapper.Map <Employee>(entity));

            await db.Save();

            entity.Id = model.Id;
            return(entity);
        }
Example #4
0
 public async Task Update(EmployeeDTO entity)
 {
     BLValidation.CheckEmployee(entity);
     db.EmployeeRepository.Update(mapper.Map <Employee>(entity));
     await db.Save();
 }
Example #5
0
 public async Task Update(History entity)
 {
     BLValidation.CheckHistory(entity);
     db.HistoryRepository.Update(mapper.Map <EmployeePosition>(entity));
     await db.Save();
 }
 public async Task Update(PositionDTO entity)
 {
     BLValidation.CheckPosition(entity);
     db.PositionRepository.Update(mapper.Map <Position>(entity));
     await db.Save();
 }