Ejemplo n.º 1
0
        public RemoveItem RemoveItems(int itemId, int returnedItemQty, string sessionId, int checkedinId)
        {
            var connectionString = Startup.connectionstring;

            using (var con = new ShoppingContext(connectionString))
            {
                var context = con.itemMasterEntity.Where(k => k.Active == true).SingleOrDefault(m => m.ItemId == itemId);
                context.ReserveQty   = context.ReserveQty - returnedItemQty;
                context.AvailableQty = context.AvailableQty + returnedItemQty;

                var remove = con.CheckInEntity.Where(m => m.UserSessionId == sessionId && m.id == checkedinId).SingleOrDefault();
                remove.Active = false;
                con.SaveChanges();
                var count = con.CheckInEntity.Where(m => m.UserSessionId == sessionId && m.Active == true).Count();

                var result = new RemoveItem()
                {
                    count    = count,
                    successs = true
                };

                return(result);
            }
        }