示例#1
0
        public ActionResult Update(DevTest devTest)
        {
            using (var context = new MyDbContext())
            {
                var userRecord = context.DevTest.Find(devTest.ID);

                userRecord.AffiliateName = devTest.AffiliateName;
                userRecord.CampaignName  = devTest.CampaignName;
                userRecord.Clicks        = devTest.Clicks;
                userRecord.Conversions   = devTest.Conversions;
                userRecord.Date          = DateTime.Now;
                userRecord.Impressions   = devTest.Impressions;



                context.DevTest.Add(userRecord);

                context.Entry(userRecord).State = EntityState.Modified;
                context.SaveChanges();
            }

            //Once the record is inserted , then notify all the subscribers (Clients)
            DevTestHub.NotifyCurrentUserInformationToAllClients();
            return(RedirectToAction("Index"));
        }
示例#2
0
        public ActionResult Delete(DevTest devTest)
        {
            using (var context = new MyDbContext())
            {
                var empRecord = context.DevTest.Find(devTest.ID);
                context.DevTest.Remove(empRecord);
                context.SaveChanges();
            }

            //Once the record is inserted , then notify all the subscribers (Clients)
            DevTestHub.NotifyCurrentUserInformationToAllClients();
            return(RedirectToAction("Index"));
        }
示例#3
0
        public ActionResult Insert(DevTest devTest)
        {
            if (ModelState.IsValid)
            {
                //Insert into Employee table
                using (var context = new MyDbContext())
                {
                    devTest.Date = DateTime.Now;
                    context.DevTest.Add(devTest);
                    context.SaveChanges();
                }
            }

            //Once the record is inserted , then notify all the subscribers (Clients)
            DevTestHub.NotifyCurrentUserInformationToAllClients();
            return(RedirectToAction("Index"));
        }