public ActionResult EditPoint(string pointID)
        {
            EtronixValidation EV           = new EtronixValidation();
            int             alert          = -1;
            string          vMessage       = null;
            List <Points>   vEditedPoint   = null;
            List <PointsMU> vCombinedLists = null;



            try {
                int vId = int.Parse(pointID);

                Entities db = new Entities();
                vEditedPoint = db.Points.Where(m => m.Id == vId).ToList();

                List <Procedures.MeasurementUnitTypes> vM = db.MeasurementUnitType.ToList();

                vCombinedLists = vEditedPoint.Join(vM, a => a.MUT_id, b => b.Id, (a, b) => new PointsMU
                {
                    Id                = a.Id,
                    PointName         = a.PointName,
                    TableName         = a.TableName,
                    DatabaseName      = a.DatabaseName,
                    Tag1              = a.Tag1,
                    Tag2              = a.Tag2,
                    Tag3              = a.Tag3,
                    MUT_id            = a.MUT_id,
                    Type              = b.Type,
                    EtronixValidation = EV
                }).ToList();

                int z = 0;
            }
            catch (Exception exception)
            {
                //Console.WriteLine(exception.Message);
                alert             = (int)EtronixValidationCode.ValidationCodeEnum.alert_danger;
                vMessage          = exception.Message + Environment.NewLine;
                EV.ValidationCode = EtronixValidationCode.ValidationDic[alert];
                EV.AddToList(vMessage);
            }

            PointsMU vPointsMu = vCombinedLists[0];

            return(View(vPointsMu));

            //return Content("rrenio");
        }
        public ActionResult EditPoint(PointsMU model)
        {
            EtronixValidation EV = new EtronixValidation();
            int    alert         = -1;
            string vMessage      = null;

            Entities _contextEntities = new Entities();

            try
            {
                if (ModelState.IsValid)
                {
                    var vPointId      = new SqlParameter("@pointID", model.Id);
                    var vPointName    = new SqlParameter("@PointName", model.PointName);
                    var vTableName    = new SqlParameter("@TableName", model.TableName);
                    var vDatabaseName = new SqlParameter("@DatabaseName", model.DatabaseName);
                    var vTag1         = new SqlParameter("@Tag1", model.Tag1);
                    var vTag2         = new SqlParameter("@Tag2", model.Tag2);
                    var vTag3         = new SqlParameter("@Tag3", model.Tag3);
                    var vMUT_id       = new SqlParameter("@MUT_id", model.MUT_id);


                    var vPointIDResult = _contextEntities.Database.SqlQuery <Procedures.ResultUpdatePoint>(
                        "UpdatePoint @PointId , @PointName , @TableName , @DatabaseName , @Tag1  , @Tag2  , @Tag3  , @MUT_id ",
                        vPointId,
                        vPointName,
                        vTableName,
                        vDatabaseName,
                        vTag1,
                        vTag2,
                        vTag3,
                        vMUT_id
                        ).ToList();

                    alert    = (int)EtronixValidationCode.ValidationCodeEnum.alert_success;
                    vMessage = "The details' point were updated";

                    EV.ValidationCode = EtronixValidationCode.ValidationDic[alert];
                    EV.AddToList(vMessage);
                    model.EtronixValidation = EV;
                }
                else
                {
                    List <string> mE = ModelState.Values.SelectMany(x => x.Errors).Select(e => e.ErrorMessage).ToList();
                    alert             = (int)EtronixValidationCode.ValidationCodeEnum.alert_danger;
                    EV.ValidationCode = EtronixValidationCode.ValidationDic[alert];
                    foreach (var msg in mE)
                    {
                        EV.AddToList(msg);
                    }
                    model.EtronixValidation = EV;
                    return(View(model));
                }
            }
            catch (Exception exception)
            {
                alert             = (int)EtronixValidationCode.ValidationCodeEnum.alert_danger;
                vMessage          = exception.Message;
                EV.ValidationCode = EtronixValidationCode.ValidationDic[alert];
                EV.AddToList(vMessage);
                model.EtronixValidation = EV;
            }

            return(View(model));
        }