public Report Update(Report item)
        {
            Repo.Update(item);
            Unit.SaveChanges();
            return item;

        }
 public Report MiniReport(string accountId)
 {
     DateTime now = DateTime.UtcNow;
     DateTime past = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0); ;
     List<Activity> activities = actRepo.GetByDate(accountId, past, now).ToList();
     double duration = activities.Sum(e => (e.EndTime - e.BeginTime).TotalMinutes);
     int steps = activities.Sum(e => e.Steps);
     double distance = activities.Sum(e => e.Distance);
     Report r = new Report { AccountId = accountId, Distance = distance, Steps = steps, Duration = duration, Date = now };
     return r;
 }
        public IHttpActionResult Put(Report item)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            try
            {
                return Ok(Logic.Update(item));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Logic.Exists(item.Id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }
        }
        public void ReportRepository()
        {
            Mock<IDbSetFactory> factory = new Mock<IDbSetFactory>();
            Mock<DbSet<Report>> dbSet = new Mock<DbSet<Report>>();

            factory.Setup(m => m.CreateDbSet<Report>()).Returns(dbSet.Object);

            ReportRepository repo = new ReportRepository(factory.Object);

            var Report = new Report();

            var sequence = new MockSequence();
            dbSet.InSequence(sequence).Setup(e => e.Add(Report));
            dbSet.InSequence(sequence).Setup(e => e.Find(Report.Id));
            dbSet.InSequence(sequence).Setup(e => e.Find(Report.Id));
            dbSet.InSequence(sequence).Setup(e => e.Find(Report.Id));
            repo.Create(Report);
            repo.Get(Report.Id);
            repo.Update(Report);
            repo.Delete(Report.Id);
        }
        public void ReportLogic()
        {
            Mock<IUnitOfWork> uow = new Mock<IUnitOfWork>();
            Mock<IReportRepository> repo = new Mock<IReportRepository>();
            Mock<IActivityRepository> activityRepo = new Mock<IActivityRepository>();
            Mock<IAccountRepository> accountRepo = new Mock<IAccountRepository>();

            ReportLogic logic = new ReportLogic(uow.Object, repo.Object, activityRepo.Object, accountRepo.Object);

            var report = new Report();
            var sequence = new MockSequence();
            repo.InSequence(sequence).Setup(r => r.Create(report));
            repo.InSequence(sequence).Setup(r => r.Update(report));
            repo.InSequence(sequence).Setup(r => r.Get(report.Id));
            repo.InSequence(sequence).Setup(r => r.Delete(report.Id));
            logic.Create();
            logic.Update(report);
            logic.Get(report.Id);
            logic.Delete(report.Id);
        }
        private static void FillReport(StackPanel view, Report report)
        {
            Grid message = new Grid();
			message.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
			message.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(10, GridUnitType.Pixel) });
			message.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

			message.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
			message.RowDefinitions.Add(new RowDefinition { Height = new GridLength(10, GridUnitType.Pixel) });

            Image image = new Image
            {
				Width = 50,
				Height =50,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                Source = new BitmapImage(new Uri("ms-appx:///Assets/clipboard.png", UriKind.Absolute))
            };

			Grid.SetRow(image, 0);
            Grid.SetColumn(image, 0);

            StackPanel rightpanel = new StackPanel();
			Grid.SetColumn(rightpanel, 2);
			Grid.SetRow(rightpanel, 0);
            TextBlock text = new TextBlock
            {
                FontSize = 15,
                TextWrapping = TextWrapping.Wrap,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                Text = "Distance: " + Math.Round(UserState.UseOldUnits ? report.Distance / 3.0 : report.Distance, 1) + 
                    (UserState.UseOldUnits ? " leagues" : " miles")
            };
            rightpanel.Children.Add(text);
            text = new TextBlock
            {
                FontSize = 15,
                TextWrapping = TextWrapping.Wrap,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                Text = "Duration: " + Math.Round(report.Distance / 60.0, 2) + " hours"
            };
            rightpanel.Children.Add(text);
            text = new TextBlock
            {
                FontSize = 15,
                TextWrapping = TextWrapping.Wrap,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                Text = "Steps: " + report.Steps
            };
            rightpanel.Children.Add(text);

            message.Children.Add(image);
            message.Children.Add(rightpanel);

            view.Children.Add(message);
        }