public DTO.EditData Get(int id, out Notification notification) { notification = new Notification() { Type = NotificationType.Success }; DTO.EditData data = new EditData() { Data = new OPSequenceDto() }; try { if (id > 0) { using (OPSequenceEntities context = CreateContext()) { OPSequence_OPSequence_View dbItem = context.OPSequence_OPSequence_View.FirstOrDefault(s => s.OPSequenceID == id); if (dbItem == null) { notification = new Notification() { Type = NotificationType.Error, Message = "Can not find data." }; return(data); } data.Data = converter.DB2DTO_Get(dbItem); } } else { data.Data.OPSequenceDetails = new List <OPSequenceDetailDto>(); } Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory(); data.WorkCenters = support_factory.GetWorkCenter(); } catch (Exception ex) { notification = new Notification() { Type = NotificationType.Error, Message = ex.Message }; return(data); } return(data); }
public DTO.OPSequenceDto DB2DTO_Get(OPSequence_OPSequence_View dbItem) { return(AutoMapper.Mapper.Map <OPSequence_OPSequence_View, DTO.OPSequenceDto>(dbItem)); }