public HttpResponseMessage Put([FromBody] fuzzy_membershipModel.Create_Detail dataModel)
 {
     try
     {
         using (ftc_projectEntities entities = new ftc_projectEntities())
         {
             var entity = entities.fuzzy_membership.FirstOrDefault(e => e.BeaconMinor == dataModel.BeaconMinor && e.Label.Contains(dataModel.Label));
             if (entity == null)
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "data Not Gound"));
             }
             else
             {
                 entity.Samples = dataModel.Samples;
                 entity.Max     = dataModel.Max;
                 entity.Min     = dataModel.Min;
                 entity.Mean    = dataModel.Mean;
                 entity.SD      = entity.SD;
                 entities.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, entity));
             }
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
        public HttpResponseMessage Post([FromBody] fuzzy_membershipModel.Create_Detail dataModel)
        {
            try
            {
                using (ftc_projectEntities entities = new ftc_projectEntities())
                {
                    fuzzy_membership newModel = new fuzzy_membership();
                    newModel.BeaconMinor = dataModel.BeaconMinor;
                    newModel.Label       = dataModel.Label;
                    newModel.Samples     = dataModel.Samples;
                    newModel.Max         = dataModel.Max;
                    newModel.Min         = dataModel.Min;
                    newModel.Mean        = dataModel.Mean;
                    newModel.SD          = dataModel.SD;
                    entities.fuzzy_membership.Add(newModel);
                    entities.SaveChanges();

                    var msg = Request.CreateResponse(HttpStatusCode.Created, newModel);
                    return(msg);
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Пример #3
0
 public void UpdateWhereTypem2()
 {
     using (ftc_projectEntities entities = new ftc_projectEntities())
     {
         var existingEntities = from c in entities.data_path.AsNoTracking()
                                where c.Type == -2
                                select c;
         var existingEntity = existingEntities.Where(e => e.Type == -2).FirstOrDefault();
         existingEntity.Position = 1;
         entities.SaveChanges();
     }
 }
Пример #4
0
        //select type, position from data_path where type=-2
        public List <Format_Detail> GetTypeEqualM2()
        {
            using (ftc_projectEntities entities = new ftc_projectEntities())
            {
                var L2Enty = from c in entities.data_path.AsNoTracking()
                             where c.Type == -2
                             select c;

                return(L2Enty.Select(s => new Format_Detail()
                {
                    Type = s.Type,
                    Position = s.Position,
                }).ToList <Format_Detail>());
            }
        }
        public List <Format_Detail> GetByIdandLabel_F(int selectBeaconMinor)
        {
            using (ftc_projectEntities entities = new ftc_projectEntities())
            {
                var L2Enty = from c in entities.fuzzy_label.AsNoTracking()
                             where c.BeaconMinor == selectBeaconMinor && c.Label.Contains("F")
                             select c;

                return(L2Enty.Select(s => new Format_Detail()
                {
                    BeaconMinor = s.BeaconMinor,
                    Position = s.Position,
                    Label = s.Label
                }).ToList <Format_Detail>());
            }
        }
        public List <Format_Detail> GetAll()
        {
            using (ftc_projectEntities entities = new ftc_projectEntities())
            {
                var L2Enty = from c in entities.fuzzy_label.AsNoTracking()
                             orderby c.BeaconMinor ascending
                             select c;

                return(L2Enty.Select(s => new Format_Detail()
                {
                    BeaconMinor = s.BeaconMinor,
                    Position = s.Position,
                    Label = s.Label
                }).ToList <Format_Detail>());
            }
        }
        public List <Format_Detail> GetAll()
        {
            using (ftc_projectEntities entities = new ftc_projectEntities())
            {
                var L2Enty = from c in entities.data_position_info.AsNoTracking()
                             orderby c.TimeStamp
                             select c;

                return(L2Enty.Select(s => new Format_Detail()
                {
                    Id = s.Id,
                    TimeStamp = s.TimeStamp,
                    Position = s.Position,
                    UserId = s.UserId
                }).ToList <Format_Detail>());
            }
        }
Пример #8
0
        public List <Format_Detail> GetAll()
        {
            using (ftc_projectEntities entities = new ftc_projectEntities())
            {
                var L2Enty = from c in entities.settings_configure.AsNoTracking()
                             orderby c.Id
                             select c;

                return(L2Enty.Select(s => new Format_Detail()
                {
                    Id = s.Id,
                    Type = s.Type,
                    Name = s.Name,
                    Value = s.Value
                }).ToList <Format_Detail>());
            }
        }
Пример #9
0
        public List <Format_Detail> GetAll()
        {
            using (ftc_projectEntities entities = new ftc_projectEntities())
            {
                var L2Enty = from c in entities.data_all.AsNoTracking()
                             orderby c.Id
                             select c;

                return(L2Enty.Select(s => new Format_Detail()
                {
                    Id = s.Id,
                    TimeStamp = s.TimeStamp,
                    Position = s.Position,
                    BeaconMinor = s.BeaconMinor,
                    RSS = s.RSS
                }).ToList <Format_Detail>());
            }
        }
        public List <Format_Detail> GetAll()
        {
            using (ftc_projectEntities entities = new ftc_projectEntities())
            {
                var L2Enty = from c in entities.settings_position.AsNoTracking()
                             orderby c.Id
                             select c;

                return(L2Enty.Select(s => new Format_Detail()
                {
                    Id = s.Id,
                    Position = s.Position,
                    X = s.X,
                    Y = s.Y,
                    Area = s.Area
                }).ToList <Format_Detail>());
            }
        }
Пример #11
0
        public List <Format_Detail> GetByPostionAndMinor(int Position, int BeaconMinor)
        {
            using (ftc_projectEntities entities = new ftc_projectEntities())
            {
                var L2Enty = from c in entities.data_all.AsNoTracking()
                             where c.Position == Position && c.BeaconMinor == BeaconMinor
                             orderby c.TimeStamp
                             select c;

                return(L2Enty.Select(s => new Format_Detail()
                {
                    Id = s.Id,
                    TimeStamp = s.TimeStamp,
                    Position = s.Position,
                    BeaconMinor = s.BeaconMinor,
                    RSS = s.RSS
                }).ToList <Format_Detail>());
            }
        }
        public List <Format_Detail> GetAll()
        {
            using (ftc_projectEntities entities = new ftc_projectEntities())
            {
                var L2Enty = from c in entities.fuzzy_membership.AsNoTracking()
                             orderby c.BeaconMinor
                             select c;

                return(L2Enty.Select(s => new Format_Detail()
                {
                    BeaconMinor = s.BeaconMinor,
                    Label = s.Label,
                    Max = s.Max,
                    Min = s.Min,
                    Mean = s.Mean,
                    Samples = s.Samples,
                    SD = s.SD
                }).ToList <Format_Detail>());
            }
        }
Пример #13
0
        public HttpResponseMessage Post([FromBody] data_position_infoModel.Create_Detail dataModel)
        {
            try
            {
                using (ftc_projectEntities entities = new ftc_projectEntities())
                {
                    data_position_info newModel = new data_position_info();
                    newModel.UserId    = dataModel.UserId;
                    newModel.Position  = dataModel.Position;
                    newModel.TimeStamp = DateTime.Now;
                    entities.data_position_info.Add(newModel);
                    entities.SaveChanges();

                    var msg = Request.CreateResponse(HttpStatusCode.Created, newModel);
                    return(msg);
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex));
            }
        }
        public HttpResponseMessage Post([FromBody] fuzzy_labelModel.Create_Detail dataModel)
        {
            try
            {
                using (ftc_projectEntities entities = new ftc_projectEntities())
                {
                    fuzzy_label newModel = new fuzzy_label();
                    newModel.Position    = dataModel.Position;
                    newModel.BeaconMinor = dataModel.BeaconMinor;
                    newModel.Position    = dataModel.Position;
                    newModel.Label       = dataModel.Label;
                    entities.fuzzy_label.Add(newModel);
                    entities.SaveChanges();

                    var msg = Request.CreateResponse(HttpStatusCode.Created, newModel);
                    return(msg);
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex));
            }
        }
 public HttpResponseMessage PutWhereTypeM2([FromBody] int position)
 {
     try
     {
         using (ftc_projectEntities entities = new ftc_projectEntities())
         {
             var entity = entities.data_path.FirstOrDefault(e => e.Type == -2);
             if (entity == null)
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Type 0 Not Gound"));
             }
             else
             {
                 entity.Position = position;
                 entities.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, entity));
             }
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }