public static Browser CreateBrowser(IBarCodes createBarcodes) { var browser = new Browser(with => { with.Module <AttachBarCodeModule>(); with.Dependency(createBarcodes); }); return(browser); }
public CommentsModule(IBarCodes barCodes, IComments comments, IUsers users, IEventLog eventLog, IGravatarService gravatarService) : base("/Comment") { this.RequiresAuthentication(); this.barCodes = barCodes; this.comments = comments; this.users = users; this.eventLog = eventLog; this.gravatarService = gravatarService; Get["/{id}"] = x => { if (!this.barCodes.Exists(x.id)) { return(Response.AsJson(Enumerable.Empty <Comment>())); } IEnumerable <Comment> commentsForBarCode = this.comments.GetCommentsForBarCode(x.id); Comment[] ret = this.gravatarService.AddAvatarToComments(commentsForBarCode).ToArray(); return(Response.AsJson(ret)); }; Post["/{id}"] = x => { if (!this.barCodes.Exists(x.id)) { return(Response.AsJson(Enumerable.Empty <Comment>())); } Comment comment = this.Bind <Comment>(); comment.Author = this.users.GetIdByUsername(this.Context.CurrentUser.UserName); this.comments.Add(comment); Comment[] commentsForBarCode = this.comments.GetCommentsForBarCode(x.id).ToArray(); this.Log(x.id, comment.Author, "COMMENT", comment.Text); return(Response.AsJson(commentsForBarCode)); }; }
public CommentsModule(IBarCodes barCodes, IComments comments, IUsers users, IEventLog eventLog, IGravatarService gravatarService) : base("/Comment") { this.RequiresAuthentication(); this.barCodes = barCodes; this.comments = comments; this.users = users; this.eventLog = eventLog; this.gravatarService = gravatarService; Get["/{id}"] = x => { if (!this.barCodes.Exists(x.id)) return Response.AsJson(Enumerable.Empty<Comment>()); IEnumerable<Comment> commentsForBarCode = this.comments.GetCommentsForBarCode(x.id); Comment[] ret = this.gravatarService.AddAvatarToComments(commentsForBarCode).ToArray(); return Response.AsJson(ret); }; Post["/{id}"] = x => { if (!this.barCodes.Exists(x.id)) return Response.AsJson(Enumerable.Empty<Comment>()); Comment comment = this.Bind<Comment>(); comment.Author = this.users.GetIdByUsername(this.Context.CurrentUser.UserName); this.comments.Add(comment); Comment[] commentsForBarCode = this.comments.GetCommentsForBarCode(x.id).ToArray(); this.Log(x.id, comment.Author, "COMMENT", comment.Text); return Response.AsJson(commentsForBarCode); }; }
public CreateBarCodeUseCase(IBarCodes barCodes) { _barCodes = barCodes; }
public BarCodeController(IBarCodes barCodes, IApiSearchService apiSearchService) { this.barCodes = barCodes; this.apiSearchService = apiSearchService; }
public ExtractQrCodeUseCase(IBarCodes barCodes) { _barCodes = barCodes; }
public BarCodeController(IBarCodes barCodes, IApiSearchService apiSearchService) { this.barCodes = barCodes; this.apiSearchService = apiSearchService; }