public bool UpdateModem(ModemDetails modemdetails, long modemId, long locationId)
        {
            try
            {
                RC_MODEMS modem = _db.RC_MODEMS.Where(x => x.MODEM_ID == modemId).Select(x => x).FirstOrDefault();

                modem.IP_ADDRESS = modemdetails.IpAddres;

                modem.IMSI = modemdetails.IMSI;

                modem.CUSTOMER_ID = modemdetails.CustomerId;

                modem.LOCATION_ID = (int)locationId;

                modem.LOCATION_ID = modemdetails.LocationId;

                modem.ACCOUNT_NAME = modemdetails.AccountName;

                _db.Entry(modem).State = System.Data.Entity.EntityState.Modified;

                _db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                _log.Error(ex.StackTrace);
            }

            return(false);
        }
        public bool AddModem(ModemDetails modemdetails)
        {
            try
            {
                RC_MODEMS modem = new RC_MODEMS()
                {
                    ACCOUNT_ID   = modemdetails.AccountId,
                    ACCOUNT_NAME = modemdetails.AccountName,
                    CUSTOMER_ID  = modemdetails.CustomerId,
                    IMSI         = modemdetails.IMSI,
                    IP_ADDRESS   = modemdetails.IpAddres,
                    LOCATION_ID  = modemdetails.LocationId,
                    IsDelete     = false,
                    // MODEM_ID = _db.RC_MODEMS.Select(x=>x.MODEM_ID).Last() + 1 //remove in production
                };

                _db.RC_MODEMS.Add(modem);

                _db.Entry(modem).State = System.Data.Entity.EntityState.Added;

                _db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                _log.Error(ex.StackTrace);
            }

            return(false);
        }
Esempio n. 3
0
        public JsonResult UpdateModem(ModemDetails modemdetails, long modemId, long locationId)
        {
            if (_modemSvc.UpdateModem(modemdetails, modemId, locationId) == true)
            {
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }

            return(Json("Failure", JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public JsonResult CreateModem(ModemDetails modemdetails)
        {
            if (_modemSvc.AddModem(modemdetails) == true)
            {
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }

            return(Json("Failure", JsonRequestBehavior.AllowGet));
        }