Esempio n. 1
0
        public ActionResult InsertFtp(FtpDTO ftp)
        {
            if (ModelState.IsValid)
            {
                TBL_FTP _ftp = new TBL_FTP();
                _ftp.ID         = ftp.ID;
                _ftp.STATION_ID = ftp.STATION_ID;
                _ftp.IP_ADDRESS = ftp.IP_ADDRESS;
                _ftp.PORT_NO    = ftp.PORT_NO;
                _ftp.USER_NAME  = ftp.USER_NAME;
                _ftp.PASSWORD   = ftp.PASSWORD;

                DB.FtpList.Add(_ftp);
                DB.SaveChanges();
            }
            else
            {
                ViewData["EditError"]       = "Please, correct all errors.";
                ViewData["EditableProduct"] = ftp;
            }

            return(PartialView("FtpGridPartial", GetFtpList()));
        }
Esempio n. 2
0
        public ActionResult UpdateFtp(FtpDTO ftp)
        {
            if (ModelState.IsValid)
            {
                TBL_FTP _ftp = DB.FtpList.AsNoTracking().FirstOrDefault(x => x.ID == ftp.ID);

                _ftp.ID         = ftp.ID;
                _ftp.STATION_ID = ftp.STATION_ID;
                _ftp.IP_ADDRESS = ftp.IP_ADDRESS;
                _ftp.PORT_NO    = ftp.PORT_NO;
                _ftp.USER_NAME  = ftp.USER_NAME;
                _ftp.PASSWORD   = ftp.PASSWORD;

                DB.Entry(_ftp).State = EntityState.Modified;

                DB.SaveChanges();
            }
            else
            {
                ViewData["EditError"]       = "Please, correct all errors.";
                ViewData["EditableProduct"] = ftp;
            }
            return(PartialView("FtpGridPartial", GetFtpList()));
        }