Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, [Bind("MemId,Pwd,MemName,Grade,IsDel,LastDate,RegDate")] TblUser tblUser)
        {
            if (id != tblUser.MemId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblUser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblUserExists(tblUser.MemId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblUser));
        }
        public async Task <IActionResult> Edit([Bind("SurveyNo,QtCode,QtType,QtText,QtBody,QtScript,UseQuotaBl,NextQuestion,EndCode,Exclude,Include,Detailorder")] TblQuestion tblQuestion)
        {
            if (tblQuestion.SurveyNo == 0)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblQuestion);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblQuestionExists(tblQuestion.SurveyNo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index), new { surveyno = tblQuestion.SurveyNo }));
            }
            ViewData["SurveyNo"] = new SelectList(_context.TblSurvey, "SurveyNo", "SmsMessage", tblQuestion.SurveyNo);
            return(View(tblQuestion));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit([Bind("SurveyNo,ListNo,CellNum,FinishBl,IngBl,RefusalBl,QuotaOverBl,StopBl,EndCode,StateCode,Col01,Col02,Col03,Col04,Col05,Col06,QuestCount")] TblList tblList)
        {
            //if (surveyno != tblList.SurveyNo || listno != tblList.ListNo)
            //{
            //    return NotFound();
            //}

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblListExists(tblList.SurveyNo, tblList.ListNo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index), "TblLists", new { surveyno = tblList.SurveyNo }));
            }
            ViewData["SurveyNo"] = new SelectList(_context.TblSurvey, "SurveyNo", "SmsMessage", tblList.SurveyNo);
            return(View(tblList));
        }
        public async Task <IActionResult> Edit(int id, [Bind("SurveyNo,QtCode,OpCode,InputType,InputLabel,InputValue,NextQuestion,EndCode,Open")] TblOption tblOption)
        {
            if (id != tblOption.SurveyNo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblOption);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblOptionExists(tblOption.SurveyNo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SurveyNo"] = new SelectList(_context.TblQuestion, "SurveyNo", "QtCode", tblOption.SurveyNo);
            return(View(tblOption));
        }
        public async Task <IActionResult> Edit(int id, [Bind("SurveyNo,SName,UseBl,SmsMessage,IngQuotaBl,LastDay,Callback,Url,Description,LogoFile,UseListCountBl,CssStyleName,UseQuotaAccessBl,LogoWidth,LogHeight,SurveyYear")] TblSurvey tblSurvey, ICollection <IFormFile> fileCollection)
        {
            if (id != tblSurvey.SurveyNo)
            {
                return(NotFound());
            }

            _logger.LogInformation($"fileCollection :{fileCollection.Count}");

            long totalSize = 0L;

            if (!fileCollection.Count.Equals(0))
            {
                var uploadDirectoryPath = Path.Combine(_environment.WebRootPath, "upload");

                foreach (IFormFile formFile in fileCollection)
                {
                    string uploadFilePath = Path.Combine(uploadDirectoryPath, formFile.FileName);
                    using (FileStream fileStream = System.IO.File.Create(uploadFilePath)) {
                        formFile.CopyTo(fileStream); fileStream.Flush();
                    } totalSize += formFile.Length;
                }
            }


            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblSurvey);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblSurveyExists(tblSurvey.SurveyNo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }



            return(View(tblSurvey));
        }