Exemplo n.º 1
0
        public bool updateCount(int id, CountEntity obj)
        {
            Count count = new Count
            {
                CountId      = id,
                Blend        = obj.Blend,
                CountName    = obj.CountName,
                SingleDouble = obj.SingleDouble,
                CreatedBy    = obj.CreatedBy,
                CreatedOn    = obj.CreatedOn,
                Description  = obj.Description,
                ModifiedBy   = obj.ModifiedBy,
                ModifiedOn   = obj.ModifiedOn
            };

            using (var db = new textilaEntities())
            {
                try
                {
                    var result = db.Counts.SingleOrDefault(b => b.CountId == id);
                    db.Entry(result).CurrentValues.SetValues(count);
                    db.SaveChanges();
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 2
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);
        }