public ActionResult EditSensorMaster(int id) { if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty)) { return(RedirectToAction("Login", "Login", null)); } ViewBag.Logout = Session["Username"].ToString().ToUpper(); ViewBag.roleid = Session["RoleID"]; String Username = Session["Username"].ToString(); using (i_facility_shaktiEntities1 db = new i_facility_shaktiEntities1()) { configurationtblsensormaster tblmc = db.configurationtblsensormasters.Find(id); if (tblmc == null) { return(HttpNotFound()); } ViewBag.Unit = new SelectList(db.tblunits.Where(m => m.IsDeleted == 0), "U_id", "Unit", tblmc.Unitid).ToList(); ViewBag.SensorGroupName = new SelectList(db.configuration_tblsensorgroup.ToList().Where(m => m.IsDeleted == 0), "SID", "SensorGroupName", tblmc.Sid).ToList(); ViewBag.SensorDataLink = new SelectList(db.configurationtblsensordatalinks.Where(m => m.IsDeleted == 0 && m.IsSensor == 1), "ParameterTypeID", "parametername", tblmc.parametertypeid).ToList(); SensorMaster sd = new SensorMaster(); sd.sensormaster = tblmc; return(View(sd)); } }
public void CreateCommand(SensorMaster sens) { if (sens == null) { throw new ArgumentNullException(nameof(sens)); } sens.SensorId = GetSensorUId(); _Context.SensorMasters.Add(sens); }
public ActionResult UpdateCommand(int id, SensorMaster sensorupdatedto) { var SensorModelRepo = _repository.GetSensorById(id); if (SensorModelRepo == null) { return(NotFound()); } _mapper.Map(sensorupdatedto, SensorModelRepo); _repository.UpdateCommand(SensorModelRepo); _repository.SaveChanges(); return(NoContent()); }
public ActionResult CreateCommand(SensorMaster sens) { if (sens.Id == 0) { _repository.CreateCommand(sens); _repository.SaveChanges(); return(CreatedAtRoute(nameof(GetSensorById), new { id = sens.Id }, sens)); } else { return(UpdateCommand(sens.Id, sens)); } }
// GET: SensorMaster public ActionResult Index() { if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty)) { return(RedirectToAction("Login", "Login", null)); } ViewBag.Logout = Session["Username"].ToString().ToUpper(); ViewBag.roleid = Session["RoleID"]; String Username = Session["Username"].ToString(); SensorMaster pa = new SensorMaster(); configurationtblsensormaster mp = new configurationtblsensormaster(); pa.sensormaster = mp; pa.sensormasterList = db.configurationtblsensormasters.Where(m => m.IsDeleted == 0).ToList(); return(View(pa)); }
public void UpdateCommand(SensorMaster sens) { //Nothing }