public void GenerateEmployeeData() { var context = new FeedbyDataContext(); // Clear existing data this.ClearData(context); for (var i = 0; i < 5; i++) { var rand = new Random((int)DateTime.Now.Ticks); var bio = this.CreateUserBio(string.Format("Sample Bio {0}", i)); var profile = this.CreateProfile(bio); profile.PictureUrl = this.pictureUrls[i]; var employee = new Employee { Id = Guid.NewGuid(), FirstName = this.firstNames[rand.Next(0, this.firstNames.Length - 1)], LastName = this.lastNames[rand.Next(0, this.lastNames.Length - 1)], Profile = profile }; employee.Username = string.Format("{0}{1}", employee.FirstName[0], employee.LastName); employee.Email = string.Format("{0}@{1}.net", employee.FirstName, employee.LastName); context.Set<Employee>().Add(employee); } context.SaveChanges(); }
private Employee CreateEmployee(string firstName, string lastName, string email) { var bio = new UserBio { Id = Guid.NewGuid(), BioDescription = "Test" }; var profile = new UserProfile { Id = Guid.NewGuid(), Bio = bio }; var employee = new Employee { Id = Guid.NewGuid(), FirstName = firstName, LastName = lastName, Email = email, Profile = profile, Username = "******" }; return employee; }
public Employee Save(Employee entity) { return this.employeeRepository.Insert(entity); }
public void Delete(Employee entity) { var query = new EmployeeIdQuery(entity.Id); var entityToDelete = this.employeeRepository.Single(query); this.employeeRepository.Delete(entityToDelete); }