public async Task <bool> UpdateJob(UpdateJobRAO rao)
        {
            var entity = await _context
                         .JobTableAccess
                         .SingleOrDefaultAsync(e => e.JobEntityId == rao.JobEntityId);

            if (rao.Name != null)
            {
                entity.Name = rao.Name;
            }
            if (rao.Company != null)
            {
                entity.Company = rao.Company;
            }
            if (rao.Desc != null)
            {
                entity.Desc = rao.Desc;
            }
            if (rao.Compensation != null)
            {
                entity.Compensation = rao.Compensation;
            }
            if (rao.Hours != null)
            {
                entity.Hours = rao.Hours;
            }
            if (rao.DesiredPersonality != null)
            {
                entity.DesiredPersonality = int.Parse(rao.DesiredPersonality.ToString());
            }

            return(_context.SaveChanges() == 1);
        }
        public void DeleteCartItemWithProductID(int product_id)
        {
            var deleted_items = _context.CartTableAccess.Where(x => x.ProductEntityId == product_id);

            foreach (CartEntity item in deleted_items)
            {
                _context.CartTableAccess.Remove(item);
            }

            _context.SaveChanges();
        }
        public bool DeletePersonality(int id)
        {
            var query = _context
                        .PersonalityTableAccess
                        .Where(e => e.UserId == id)
                        .ToList();

            int count = 0;

            foreach (var entity in query)
            {
                _context.Remove(entity);
                count++;
            }

            return(_context.SaveChanges() == count);
        }
예제 #4
0
 public int commit()
 {
     return(_context.SaveChanges());
 }