public void AddDataPoint(CreateDataPointViewModel model)
 {
     using (var db = new GainTrackerContext(ACTIVE_CONNECTION))
     {
         db.DataPoints.Add(Mapper.Map<DataPoint>(model));
         db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
        public ActionResult AddDataPoint(int trackedDataId)
        {
            var vm = new CreateDataPointViewModel
            {
                TrackedDataId = trackedDataId
            };

            return View();
        }
Ejemplo n.º 3
0
        public ActionResult AddDataPoint(CreateDataPointViewModel model)
        {
            if (!ModelState.IsValid)
                return View(model);

            repository.AddDataPoint(model);

            repository.AddStatistic(new CreateStatisticModel
            {
                Type = (int)StatisticsHelper.StatisticTypes.AddedData,
                Time = DateTime.Now,
                IPAddress = Request.UserHostAddress,
                UserName = User.Identity.Name,
                Email = Membership.GetUser(User.Identity.Name).Email
            });

            return RedirectToAction("Index", "Profile");
        }