public void AddTrackedData(CreateTrackedDataViewModel model)
 {
     using (var db = new GainTrackerContext(ACTIVE_CONNECTION))
     {
         db.TrackedData.Add(Mapper.Map<TrackedData>(model));
         db.SaveChanges();
     }
 }
        public ActionResult AddTrackedData()
        {
            var vm = new CreateTrackedDataViewModel
            {
                UserName = Membership.GetUser().UserName
            };

            return View(vm);
        }
        public ActionResult AddTrackedData(CreateTrackedDataViewModel model)
        {
            repository.AddTrackedData(model);

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

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