public BlogList Get() { BlogItemHandler itemHandler = new BlogItemHandler(); BlogList list = new BlogList { Title = "A mixed blog", }; list.Items = BlogDB.GetAll().Select(entry => new BlogItem { Id = entry.AuthorId, Title = entry.Title, Text = entry.Text, CreatedDate = entry.CreatedDate, SelfLink = typeof(BlogItem).CreateUri(new { Id = entry.Id }) }).ToList(); AuthorDB.AuthorEntry author = AuthorDB.Get(0); list.AuthorName = author.Name; list.AuthorLink = typeof(Author).CreateUri(new { Id = author.Id }); list.EditLink = typeof(BlogItemCreationDescriptor).CreateUri(); // Use relative path to verify that Ramone Links/Follow/Select etc. works with rel. paths list.SearchDescriptionLink = BlogConstants.SearchDescriptionSubPath; return(list); }
public BlogItem Get(int id) { BlogDB.PostEntry postEntry = BlogDB.Get(id); AuthorDB.AuthorEntry authorEntry = AuthorDB.Get(postEntry.AuthorId); BlogItem item = new BlogItem { Id = postEntry.Id, Title = postEntry.Title, Text = postEntry.Text, CreatedDate = postEntry.CreatedDate, AuthorName = authorEntry.Name }; item.SelfLink = typeof(BlogItem).CreateUri(new { Id = postEntry.Id }); item.UpLink = typeof(BlogList).CreateUri(); item.AuthorLink = typeof(Author).CreateUri(new { Id = authorEntry.Id }); if (postEntry.ImageId != null) { item.ImageLink = typeof(Image).CreateUri(new { Id = postEntry.ImageId }); } return(item); }
public static List <BookDB> GenerateBooks(int count, AuthorDB author, GenreDB genre) { return(Fixture.Build <BookDB>() .With(x => x.Author, author) .With(x => x.AuthorId, author.Id) .With(x => x.Genre, genre) .With(x => x.GenreId, genre.Id) .CreateMany(count) .ToList()); }
public static bool Delete(Author myAuthor) { if (myAuthor != null) { return(AuthorDB.Delete(myAuthor.id)); } else { return(false); } }
internal Author Map(AuthorDB author) { if (author == null) { return(null); } return(new Author() { Id = author.Id, AuthorName = author.AuthorName, AuthorSurname = author.AuthorSurname }); }
private Author Map(AuthorDB authorDB) { if (authorDB == null) { return(null); } return(new Author() { Id = authorDB.Id, AuthorName = authorDB.AuthorName, AuthorSurname = authorDB.AuthorSurname }); }
public Author Get(int id) { AuthorDB.AuthorEntry entry = AuthorDB.Get(id); Author a = new Author { Id = entry.Id, Name = entry.Name, EMail = entry.EMail }; a.SelfLink = typeof(Author).CreateUri(new { Id = a.Id }); return(a); }
public static Author GetItem(string username) { return(AuthorDB.GetItem(username)); }
public static Author GetItem(long id) { return(AuthorDB.GetItem(id)); }
public static List <Author> GetList(int StartRow, int PageSize) { return(AuthorDB.GetList(StartRow, PageSize)); }
public static List <Author> GetList() { return(AuthorDB.GetList()); }
/// <summary> /// Returns the total number of authors in the database /// </summary> /// <param name="StartRow"> /// The start position in the result set to retrieve records from /// </param> /// <param name="PageSize"> /// The maximum number of records to retrieve from position StartRow /// </param> /// <returns> /// Returns the total number of authors in the database /// </returns> public static int Count(int StartRow, int PageSize) { return(AuthorDB.Count(StartRow, PageSize)); }
public static long Save(Author myAuthor) { return(AuthorDB.Save(myAuthor)); }