public object Post(LogApplicationStartUpRequest request) { var session = this.GetSession(); var account = _dao.FindById(new Guid(session.UserAuthId)); var command = new LogApplicationStartUp { UserId = account.Id, Email = account.Email, DateOccured = request.StartUpDate, ApplicationVersion = request.ApplicationVersion, Platform = request.Platform, PlatformDetails = request.PlatformDetails, ServerVersion = Assembly.GetAssembly(typeof(ApplicationInfoService)).GetName().Version.ToString(), Latitude = request.Latitude, Longitude = request.Longitude }; _commandBus.Send(command); return(new HttpResult(HttpStatusCode.OK)); }
public void Handle(LogApplicationStartUp command) { using (var context = _contextFactory.Invoke()) { // Check if a log from this user already exists. If not, create it. var log = context.Find <AppStartUpLogDetail>(command.UserId) ?? new AppStartUpLogDetail { UserId = command.UserId, }; // Update log details log.DateOccured = command.DateOccured; log.ApplicationVersion = command.ApplicationVersion; log.Platform = command.Platform; log.PlatformDetails = command.PlatformDetails; log.ServerVersion = Assembly.GetAssembly(typeof(AppStartUpLogDetail)).GetName().Version.ToString(); log.Latitude = command.Latitude; log.Longitude = command.Longitude; context.Save(log); } }