Example #1
0
        public IHttpActionResult Putasset_def(decimal id, asset_def asset_def)
        {
            if (id != asset_def.ad_id)
            {
                return(BadRequest());
            }

            db.Entry(asset_def).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!asset_defExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public IHttpActionResult Getasset_def(decimal id)
        {
            asset_def asset_def = db.asset_def.Find(id);

            if (asset_def == null)
            {
                return(NotFound());
            }

            return(Ok(asset_def));
        }
Example #3
0
        public List <asset_type> Getasset_Types(string name)
        {
            db.Configuration.ProxyCreationEnabled = true;
            asset_def         asset = db.asset_def.Where(x => x.ad_name == name).FirstOrDefault();
            List <asset_type> list  = new List <asset_type>();

            if (asset != null)
            {
                list = db.asset_type.Where(x => x.at_id == asset.ad_type_id).ToList();
            }
            return(list);
        }
Example #4
0
        public IHttpActionResult Deleteasset_def(decimal id)
        {
            asset_def asset_def = db.asset_def.Find(id);

            if (asset_def == null)
            {
                return(NotFound());
            }

            db.asset_def.Remove(asset_def);
            db.SaveChanges();

            return(Ok(asset_def));
        }
Example #5
0
        public int  Postasset_def(asset_def asset_def)
        {
            asset_def asset = new asset_def();

            asset = db.asset_def.Where(x => x.ad_name == asset_def.ad_name && x.ad_type_id == asset_def.ad_type_id).FirstOrDefault();
            if (asset == null)
            {
                db.asset_def.Add(asset_def);
                db.SaveChanges();
                return(1);
            }
            else
            {
                return(0);
            }
        }