Пример #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            _context.Credentials = CredentialCache.DefaultNetworkCredentials;
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.AddToContractCompany(ContractCompany);
            _context.BeginSaveChanges(adoSave_RLMember, ContractCompany);

            var company = _context.ContractCompany;

            DataServiceQuery <ContractCompany> query = company;

            TaskFactory <IEnumerable <ContractCompany> > taskFactory = new TaskFactory <IEnumerable <ContractCompany> >();
            var kompany = await taskFactory.FromAsync(query.BeginExecute(null, null), iar => query.EndExecute(iar));

            ContractCompany2 = kompany.FirstOrDefault();

            _context.DeleteObject(ContractCompany2);
            _context.BeginSaveChanges(adoSave_RLMember, ContractCompany2);

            return(RedirectToPage("./Index"));
        }
Пример #2
0
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        public async Task <IActionResult> OnPostAsync()
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        {
            _context.Credentials = CredentialCache.DefaultNetworkCredentials;
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var contract = _context.Contract;

            DataServiceQuery <Contract> query = contract;

            TaskFactory <IEnumerable <Contract> > taskFactory = new TaskFactory <IEnumerable <Contract> >();
            var kontrakt = await taskFactory.FromAsync(query.BeginExecute(null, null), iar => query.EndExecute(iar));

            Contract2 = kontrakt.FirstOrDefault();

            _context.DeleteObject(Contract2);
            _context.BeginSaveChanges(adoSave_RLMember, Contract2);

            _context.AddToContract(Contract);
            _context.BeginSaveChanges(adoSave_RLMember, Contract);
            return(RedirectToPage("./Index"));
        }
Пример #3
0
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        public async Task <IActionResult> OnPostAsync()
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        {
            _context.Credentials = CredentialCache.DefaultNetworkCredentials;
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.AddToCustomer(Customer);
            _context.BeginSaveChanges(adoSave_RLMember, Customer);

            return(RedirectToPage("./Index"));
        }
Пример #4
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            _context.Credentials = CredentialCache.DefaultNetworkCredentials;
            if (id == null)
            {
                return(NotFound());
            }

            var contracts = _context.Contract;

            DataServiceQuery <Contract> query = contracts;

            TaskFactory <IEnumerable <Contract> > taskFactory = new TaskFactory <IEnumerable <Contract> >();
            var kontract = await taskFactory.FromAsync(query.BeginExecute(null, null), iar => query.EndExecute(iar));

            Contract = kontract.SingleOrDefault(m => m.Contract_No == id);

            //_context.AttachTo("Contracts", Contract);
            //_context.AddLink(Contract, "Contract_No", Contract);
            _context.DeleteObject(Contract);
            _context.BeginSaveChanges(adoSave_RLMember, Contract);

            return(RedirectToPage("./Index"));
        }