Ejemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!QuestionExists(Question.QuestionId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("Details", new { id = Question.AccreditationStandartId }));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AccreditationStandartExists(AccreditationStandart.AccreditationStandartId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var file = HttpContext.Request.Form.Files;

            if (file != null)
            {
                using (var memoryStream = new MemoryStream())
                {
                    await file[0].CopyToAsync(memoryStream);

                    AgedCareCenter.Logo = memoryStream.ToArray();
                }
            }

            _context.Attach(AgedCareCenter).State = EntityState.Modified;
            if (AgedCareCenter.Logo == null || AgedCareCenter.Logo.Length == 0)
            {
                _context.Attach(AgedCareCenter).Property(acc => acc.Logo).IsModified = false;
            }

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AgedCareCenterExists(AgedCareCenter.AgedCareCenterId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

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