예제 #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(PortfolioUpload).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PortfolioUploadExists(PortfolioUpload.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
예제 #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.PortfolioUpload.Add(PortfolioUpload);
            await _context.SaveChangesAsync();

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

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

            if (PortfolioUpload != null)
            {
                //move to trash can
                moveFileToTrashCanFolder(PortfolioUpload.FileName, DateTime.Now.ToString("[ddMMMyyyy_hhmmss]"));

                _context.PortfolioUpload.Remove(PortfolioUpload);
                await _context.SaveChangesAsync();
            }

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