Esempio n. 1
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);
        }
Esempio n. 2
0
 public async Task Update(EmployeeDTO entity)
 {
     BLValidation.CheckEmployee(entity);
     db.EmployeeRepository.Update(mapper.Map <Employee>(entity));
     await db.Save();
 }