public SchemasEditModel AddSchemas(SchemasEditModel newSchemasEditModel) { try { lesson_schemas schemas = new lesson_schemas(); schemas.class_type_id = newSchemasEditModel.TypeId; schemas.lesson_name = newSchemasEditModel.LessonName; schemas.level_name = newSchemasEditModel.LevelName; schemas.sequence_num = newSchemasEditModel.Seq; _unitOfWork.AddAction(schemas, DataActions.Add); _unitOfWork.Save(); newSchemasEditModel.Id = schemas.lesson_schemas_id; return(newSchemasEditModel); } catch (RepositoryException rex) { string msg = rex.Message; string reason = rex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } catch (Exception ex) { string msg = ex.Message; string reason = ex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } }
private SchemasEditModel BuildModel(lesson_schemas schemas) { if (schemas == null) { return(null); } else { SchemasEditModel schemasModel = new SchemasEditModel(); schemasModel.TypeId = schemas.class_type_id; schemasModel.Id = schemas.lesson_schemas_id; schemasModel.LessonName = schemas.lesson_name; schemasModel.LevelName = schemas.level_name; schemasModel.Seq = schemas.sequence_num.Value; return(schemasModel); } }