public void HireEmployee(NewEmployeeProfile profile) { using (var context = new NorthwindContext()) { if (profile.RawPhoto != null) { profile.RawPhoto = OleImageHelper.AddOleHeader(profile.RawPhoto); } var employee = new Employee() { FirstName = profile.FirstName, LastName = profile.LastName, Title = profile.Title, TitleOfCourtesy = profile.TitleOfCourtesy, BirthDate = profile.BirthDate, HireDate = profile.StartDate, Address = profile.Address, City = profile.City, Region = profile.Region, PostalCode = profile.PostalCode, Country = profile.Country, HomePhone = profile.HomePhone, Extension = profile.Extension, Photo = profile.RawPhoto, Notes = profile.Notes, ReportsTo = profile.Supervisor }; context.Employees.Add(employee); context.SaveChanges(); } }
public bool FromGdiPlusBitmap(System.Drawing.Image image) { if (image == null) { return(false); } OleImageHelper utils = new OleImageHelper(); Picture = (IPictureDisp)utils.GetIPictureFromPicture(image); return(true); }
public System.Drawing.Image ToGdiPlusBitmap() { var utils = new OleImageHelper(); return(utils.GetPictureFromIPicture(Picture)); }