using System.Linq; using Luticate2.Utils.Utils; using WebApiWebSem.DataAccess.Models; using WebApiWebSem.Dbo.Articles; using WebApiWebSem.Dbo.ArticlesFields; namespace WebApiWebSem.DataAccess { public static class ModelsDbo { public static ArticlesFieldsDbo ToDbo(this articles_fields model) { return new ArticlesFieldsDbo { Property = model.property, Type = model.type, Value = model.value }; } public static ArticlesDbo ToDbo(this articles model) { return new ArticlesDbo { CreatedAt = model.created_at.ToDbo(), Fields = model.articles_fields_fk.Select(fields => fields.ToDbo()).ToList(), Id = model.id, PictureCaption = model.picture_caption, PictureUrl = model.picture_url, Text = model.text, Type = model.type, UpdatedAt = model.updated_at.ToDbo() }; } } }