public AboutMeModule(IAboutMeRepository repo) : base("/posts") { this._repo = repo; this.InitPost(); Get("/", async args => { var post = await this._repo.GetFirstPost(); return(Response.AsJson(post)); }); Get("/all", async args => { var posts = await this._repo.GetAllPosts(); return(Response.AsJson(posts)); }); Post("/", async args => { this.RequiresAuthentication(); this.RequiresClaims(c => c.Value.Equals("admin")); var post = this.Bind <AboutMe>(); if (String.IsNullOrWhiteSpace(post.Text)) { return(Response.AsJson(new { Status = "error", Message = "There has to be SOME text" })); } await this._repo.AddPost(post); return(Response.AsJson(new { Status = "success", Message = "Done" })); }); }
public AboutMeLogic(IAboutMeRepository aboutMeRepository) { _aboutMeRepository = aboutMeRepository; }
public AboutMeController(IAboutMeRepository repository) { this.repository = repository; }
public Bootstrapper(string mongodbUrl) { this._subscriberRepository = new SubscriberRepository(mongodbUrl); this._userRepository = new UserRepository(mongodbUrl); this._aboutMeRepository = new AboutMeRepository(mongodbUrl); }