コード例 #1
0
 public void AddDataPoint(CreateDataPointViewModel model)
 {
     using (var db = new GainTrackerContext(ACTIVE_CONNECTION))
     {
         db.DataPoints.Add(Mapper.Map <DataPoint>(model));
         db.SaveChanges();
     }
 }
コード例 #2
0
        public ActionResult AddDataPoint(int trackedDataId)
        {
            var vm = new CreateDataPointViewModel
            {
                TrackedDataId = trackedDataId
            };

            return(View());
        }
コード例 #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"));
        }