예제 #1
0
        public EmployeeMD ModifyEmployee(EmployeeMD mod)
        {
            var entity = mod.Translate();

            try
            {
                _EmployeeRepo.Update(entity);
                _EmployeeRepo.CommitAllChanges();
                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_UPDATE, "Employee"));
            }
            catch (Exception)
            {
                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_UPDATE_ERROR, "Employee"));
            }

            return(mod);
        }
예제 #2
0
        public EmployeeMD RegisterEmployee(EmployeeMD mod)
        {
            try
            {
                var entity = mod.Translate();
                _EmployeeRepo.Insert(entity);
                _EmployeeRepo.CommitAllChanges();
                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_ADD, "Employee"));
                mod.Id = entity.Id;
            }
            catch (Exception ex)
            {
                mod.AddErrorMessage(string.Format(AppConstants.CRUD_ADD_ERROR, "Employee"));
            }

            return(mod);
        }
예제 #3
0
        public EmployeeMD DeleteEmployee(long id)
        {
            var mod = new EmployeeMD();

            try
            {
                var Employee = _EmployeeRepo.Fetch(x => x.IsActive);
                Employee.IsActive = false;
                _EmployeeRepo.Update(Employee);
                _EmployeeRepo.CommitAllChanges();

                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_DELETE, "Employee"));
            }
            catch (Exception ex)
            {
                mod.AddErrorMessage(string.Format(AppConstants.CRUD_DELETE_ERROR, "Employee"));
            }
            return(mod);
        }