protected override void DataPortal_Update() { using (var ctx = DalFactory.GetManager()) { var dal = ctx.GetProvider <DAL.Interfaces.IEmployeeInformationDal>(); using (BypassPropertyChecks) { var dto = new EmployeeInformationDto { Id = this.Id, FirstName = this.FirstName, LastName = this.LastName, Title = this.Title, Address = this.Address, City = this.City, State = this.State, Zip = this.Zip, ProfilePicture = this.ProfilePicture }; dal.Update(dto); } } }
public void Create(EmployeeInformationDto value) { if (value != null) { var employee = mapper.Map <EmployeeInformationDto, Employee>(value); var career = mapper.Map <EmployeeInformationDto, CareerHistory>(value); unitOfWork.EmployeeRepository.Create(employee); unitOfWork.CareerRepository.Create(career); } }
private void Child_Fetch(EmployeeInformationDto item) { Id = item.Id; FirstName = item.FirstName; LastName = item.LastName; Title = item.Title; Address = item.Address; City = item.City; State = item.State; Zip = item.Zip; ProfilePicture = item.ProfilePicture; }
public EmployeeInformationDto Get(int id) { EmployeeInformationDto dto = null; var employee = unitOfWork.EmployeeRepository.Get(id); if (employee != null) { var actualPosition = GetEmployeeActualPosition(employee.Id); dto = mapper.Map <Employee, EmployeeInformationDto>(employee); dto = mapper.Map <CareerHistory, EmployeeInformationDto>(actualPosition); } return(dto); }
public void Insert(EmployeeInformationDto item) { item.Id = MockDb.Employees.Max(c => c.Id) + 1; //item.LastChanged = MockDb.GetTimeStamp(); var newItem = new EmployeeData { Id = item.Id, FirstName = item.FirstName, LastName = item.LastName, Title = item.Title, Address = item.Address, City = item.City, State = item.State, Zip = item.Zip, ProfilePicture = item.ProfilePicture }; MockDb.Employees.Add(newItem); }
public void Update(EmployeeInformationDto item) { var data = (from r in MockDb.Employees where r.Id == item.Id select r).FirstOrDefault(); if (data == null) { throw new DataNotFoundException("Project"); } ; data.FirstName = item.FirstName; data.LastName = item.LastName; data.Title = item.Title; data.Address = item.Address; data.City = item.City; data.State = item.State; data.Zip = item.Zip; data.ProfilePicture = item.ProfilePicture; }
// POST: api/Employee public void Post([FromBody] EmployeeInformationDto value) { service.Create(value); }