Exemplo n.º 1
0
        public bool saveBlend(BlendEntity obj)
        {
            Blend blend = new Blend
            {
                BlendName = obj.BlendName
            };

            using (var db = new textilaEntities())
            {
                try
                {
                    blend = db.Blends.Add(blend);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public bool deleteBlend(BlendEntity obj)
        {
            Blend blend = new Blend
            {
                BlendId   = obj.BlendId,
                BlendName = obj.BlendName
            };

            using (var db = new textilaEntities())
            {
                try
                {
                    db.Blends.Remove(blend);
                }
                catch (Exception)
                {
                    return(false);
                }
                return(true);
            }
        }
Exemplo n.º 3
0
        public bool updateBlend(int id, BlendEntity obj)
        {
            Blend blend = new Blend
            {
                BlendId   = id,
                BlendName = obj.BlendName
            };

            using (var db = new textilaEntities())
            {
                try
                {
                    var result = db.Blends.SingleOrDefault(b => b.BlendId == id);
                    //result = blend;
                    db.Entry(result).CurrentValues.SetValues(blend);
                    db.SaveChanges();
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 4
0
 public bool deleteBlend(BlendEntity blend)
 {
     return(DA.deleteBlend(blend));
 }
Exemplo n.º 5
0
 public bool updateBlend(int id, BlendEntity blend)
 {
     return(DA.updateBlend(id, blend));
 }
Exemplo n.º 6
0
 public bool saveBlend(BlendEntity blend)
 {
     return(DA.saveBlend(blend));
 }
Exemplo n.º 7
0
 // DELETE api/<controller>/5
 public void Delete(BlendEntity value)
 {
     // BL.deleteCount(value);
 }
Exemplo n.º 8
0
 // PUT api/<controller>/5
 public bool Put(int id, [FromBody] BlendEntity value)
 {
     return(BL.updateBlend(id, value));
 }
Exemplo n.º 9
0
 // POST api/<controller>
 public bool Post([FromBody] BlendEntity value)
 {
     return(BL.saveBlend(value));
 }