public void AddDataPoint(CreateDataPointViewModel model) { using (var db = new GainTrackerContext(ACTIVE_CONNECTION)) { db.DataPoints.Add(Mapper.Map <DataPoint>(model)); db.SaveChanges(); } }
public ActionResult AddDataPoint(int trackedDataId) { var vm = new CreateDataPointViewModel { TrackedDataId = trackedDataId }; return(View()); }
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")); }