public ActionResult Create([Bind(Include = "Id,Name")] AspNetRole aspNetRole)
        {
            if (ModelState.IsValid)
            {
                db.AspNetRoles.Add(aspNetRole);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aspNetRole));
        }
        public ActionResult Create([Bind(Include = "Id,Name")] T_PlcBrand t_PlcBrand)
        {
            if (ModelState.IsValid)
            {
                db.T_PlcBrand.Add(t_PlcBrand);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(t_PlcBrand));
        }
        public ActionResult Create([Bind(Include = "Id,Name,IpAddress,T_PlcBrandId")] T_Plc t_Plc)
        {
            if (ModelState.IsValid)
            {
                db.T_Plc.Add(t_Plc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.T_PlcBrandId = new SelectList(db.T_PlcBrand, "Id", "Name", t_Plc.T_PlcBrandId);
            return(View(t_Plc));
        }
        public ActionResult Create([Bind(Include = "Id,Name,T_PlcId")] T_DataPoint t_DataPoint)
        {
            if (ModelState.IsValid)
            {
                db.T_DataPoint.Add(t_DataPoint);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.T_PlcId = new SelectList(db.T_Plc, "Id", "Name", t_DataPoint.T_PlcId);
            return(View(t_DataPoint));
        }
        public ActionResult Create([Bind(Include = "Id,T_DataPoint,Value,DateTime")] T_DataValue t_DataValue)
        {
            if (ModelState.IsValid)
            {
                db.T_DataValue.Add(t_DataValue);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.T_DataPoint = new SelectList(db.T_DataPoint, "Id", "Name", t_DataValue.T_DataPoint);
            return(View(t_DataValue));
        }
Esempio n. 6
0
        public ActionResult Create([Bind(Include = "Id,T_UserId,Name,Created,Updated")] T_SavedChart t_SavedChart)
        {
            if (ModelState.IsValid)
            {
                db.T_SavedChart.Add(t_SavedChart);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.T_UserId = new SelectList(db.AspNetUsers, "Id", "Email", t_SavedChart.T_UserId);
            return(View(t_SavedChart));
        }
Esempio n. 7
0
        public ActionResult Create([Bind(Include = "Id,T_SavedChartId,T_DataPointId")] T_ChartData t_ChartData)
        {
            if (ModelState.IsValid)
            {
                db.T_ChartData.Add(t_ChartData);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.T_DataPointId  = new SelectList(db.T_DataPoint, "Id", "Name", t_ChartData.T_DataPointId);
            ViewBag.T_SavedChartId = new SelectList(db.T_SavedChart, "Id", "T_UserId", t_ChartData.T_SavedChartId);
            return(View(t_ChartData));
        }
        public ActionResult Create([Bind(Include = "Id,T_UserId,T_PlcId")] T_UserPlc t_UserPlc)
        {
            if (ModelState.IsValid)
            {
                db.T_UserPlc.Add(t_UserPlc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.T_UserId = new SelectList(db.AspNetUsers, "Id", "Email", t_UserPlc.T_UserId);
            ViewBag.T_PlcId  = new SelectList(db.T_Plc, "Id", "Name", t_UserPlc.T_PlcId);
            return(View(t_UserPlc));
        }
        public ActionResult Create([Bind(Include = "Id,UserId,RoleId")] AspNetUserRole aspNetUserRole)
        {
            if (ModelState.IsValid)
            {
                db.AspNetUserRoles.Add(aspNetUserRole);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.RoleId = new SelectList(db.AspNetRoles, "Id", "Name", aspNetUserRole.RoleId);
            ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email", aspNetUserRole.UserId);
            return(View(aspNetUserRole));
        }
Esempio n. 10
0
        internal int SaveChart(string username, string chartname, dynamic points)
        {
            //var user = User.Identity.GetUserId();
            var user  = db.AspNetUsers.FirstOrDefault(x => x.UserName == username);
            var chart = new T_SavedChart
            {
                T_UserId = user.Id,
                Created  = DateTime.Now,
                Updated  = DateTime.Now,
                Name     = chartname
            };

            db.T_SavedChart.Add(chart);
            db.SaveChanges();
            foreach (var point in points)
            {
                GenerateChartData(Convert.ToInt16(point), chart.Id);
            }
            return(chart.Id);
            // throw new NotImplementedException();
        }