public override DTO.EditFormData GetData(int id, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.EditFormData data = new DTO.EditFormData(); data.Data = new DTO.FrameMaterialProfile(); data.Data.FrameMaterialProfileFactories = new List <DTO.FrameMaterialProfileFactory>(); data.Factories = new List <Module.Support.DTO.Factory>(); data.FrameMaterials = new List <Module.Support.DTO.FrameMaterial>(); //try to get data try { if (id > 0) { using (FrameMaterialProfileMngEntities context = CreateContext()) { var profile = context.FrameMaterialProfileMng_FrameMaterialProfile_View.FirstOrDefault(o => o.FrameMaterialProfileID == id); if (profile == null) { throw new Exception("Can not found the profile to edit"); } data.Data = converter.DB2DTO_FrameMaterialProfile(profile); } } data.Factories = supportFactory.GetFactory().ToList(); data.FrameMaterials = supportFactory.GetFrameMaterial().ToList(); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }