public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Update_License = await _context.Update_License.FirstOrDefaultAsync(m => m.UpdateLicenseID == id);

            if (Update_License == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }


            _context.Attach(License).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LicenseExists(License.LicenseID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            var Update = new Update_License();

            Update.Date = DateTime.Now;
            Update.License_LicenseID = License.LicenseID;
            Update.LicenseName       = License.LicenseName;
            Update.SoftewareName     = License.SoftewareName;
            Update.PurchaseDate      = License.PurchaseDate;
            Update.StartDate         = License.StartDate;
            Update.ExpireDate        = License.ExpireDate;
            Update.PONumber          = License.PONumber;
            Update.Attachfiles       = License.Attachfiles;
            Update.Note   = License.Note;
            Update.Status = License.Status;
            Update.Supplier_SupplierID     = License.Supplier_SupplierID;
            Update.Department_DepartmentID = License.Department_DepartmentID;
            Update.Company_CompanyID       = License.Company_CompanyID;
            Update.Employee = 2012;
            _context.Update_License.Add(Update);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Update_License = await _context.Update_License.FindAsync(id);

            if (Update_License != null)
            {
                _context.Update_License.Remove(Update_License);
                await _context.SaveChangesAsync();
            }

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