public JsonResult SavePanelResize(int stationId, int stringId, int height, int width) { var isTherePanel = DB.PanelLocations.Where(w => w.STATION_ID == stationId && w.STRING_ID == stringId).FirstOrDefault(); if (isTherePanel != null) { TBL_PANEL_LOCATIONS updateItem = isTherePanel; updateItem.RESIZE_HEIGHT = height; updateItem.RESIZE_WIDTH = width; updateItem.UPDATE_DATE = DateTime.Now; DB.Entry(updateItem).State = EntityState.Modified; DB.SaveChanges(); } return(Json(true, JsonRequestBehavior.AllowGet)); }
public JsonResult SavePanelLocation(int stationId, int stringId, string locX, string locY) { var isTherePanel = DB.PanelLocations.Where(w => w.STATION_ID == stationId && w.STRING_ID == stringId).FirstOrDefault(); if (isTherePanel == null) { DB.PanelLocations.Add(new TBL_PANEL_LOCATIONS { STATION_ID = stationId, STRING_ID = stringId, LOCATIONSX = locX, LOCATIONSY = locY, UPDATE_DATE = DateTime.Now }); DB.SaveChanges(); } else { TBL_PANEL_LOCATIONS updateItem = isTherePanel; updateItem.LOCATIONSX = locX; updateItem.LOCATIONSY = locY; updateItem.UPDATE_DATE = DateTime.Now; DB.Entry(updateItem).State = EntityState.Modified; DB.SaveChanges(); } return(Json(true, JsonRequestBehavior.AllowGet)); }