예제 #1
0
        public sensor_soil SensorSoilCreate(m_SensorSoil request)
        {
            var qry = db.Database.SqlQuery <sensor_soil>("[farmnet].[s_Sensor_soil_Create] @serial_number,@soil_data",
                                                         new SqlParameter("@serial_number", request.serial_number),
                                                         new SqlParameter("@soil_data", request.soil_data)
                                                         ).FirstOrDefault();

            if (qry != null)
            {
                return(qry);
            }
            return(null);
        }
예제 #2
0
 public IHttpActionResult UpdateSensorSoil([FromBody] m_SensorSoil request, int id)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var res = _SensorSoil.SensorSoilEdit(request, id);
             if (res != null)
             {
                 return(Json(res));
             }
             return(BadRequest("Update data sensor failed."));
         }
         catch (Exception ex)
         {
             return(BadRequest(ex.Message));
         }
     }
     return(BadRequest("Model is incorrect."));
 }