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

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblPaymentsExists(TblPayments.PaymentId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

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

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblFinancialBalanceExists(TblFinancialBalance.BusinessId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            Message = "اطلاعات به روز شد.";
            TabPage = "payment";
            return(RedirectToPage("./Index"));
        }
예제 #3
0
        public async Task <IActionResult> OnPostAsync(IFormFile Binary, string Subject)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            if (Binary != null)
            {
                var res = await Services.Upload(Binary);

                tblBinarys.Binary     = res;
                tblBinarys.FileFormat = Path.GetExtension(Binary.FileName).Replace(".", "");
            }
            tblBinarys.Subject = Subject;
            _context.Attach(tblBinarys).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            ViewData["OnTab"]   = "upload";
            TabPage             = "upload";
            Message             = "مدرک '" + tblBinarys.Subject + "' ویرایش شد.";
            TempData["Message"] = "مدرک '" + tblBinarys.Subject + "' ویرایش شد.";
            try
            {
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblBinarysExists(tblBinarys.BinaryId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(RedirectToPage("./Index"));
        }
예제 #4
0
        public async Task <IActionResult> OnPostAsync(int?yesno3, int?yesno4)
        {
            try
            {
                TblQuestionnaire Questionnaire = new TblQuestionnaire
                {
                    Question1     = tblQuestionnaire.Question1,
                    Question11    = tblQuestionnaire.Question11,
                    Question12    = tblQuestionnaire.Question12,
                    Question13    = tblQuestionnaire.Question13,
                    Question14    = tblQuestionnaire.Question14,
                    Question2     = tblQuestionnaire.Question2,
                    Question3Disp = tblQuestionnaire.Question3Disp,
                    Question4Disp = tblQuestionnaire.Question4Disp,
                    Question5     = tblQuestionnaire.Question5,
                    CreateTime    = DateTime.Now
                };
                if (yesno3 == 1)
                {
                    Questionnaire.Question3 = "بلی";
                }
                else
                {
                    Questionnaire.Question3 = "خیر";
                }
                if (yesno4 == 1)
                {
                    Questionnaire.Question4 = "بلی";
                }
                else
                {
                    Questionnaire.Question4 = "خیر";
                }

                Questionnaire.SystemCode = Services.UserMemberId;
                Questionnaire.CodeYekta  = Services.CurrentMember.کدیکتا;
                Questionnaire.Qid        = tblQuestionnaire.Qid;
                Qid = tblQuestionnaire.Qid;
                if (Qid == null || Qid == 0)
                {
                    _context.TblQuestionnaires.Update(Questionnaire);
                }
                else
                {
                    _context.Attach(Questionnaire).State = EntityState.Modified;
                }

                await _context.SaveChangesAsync();

                TempData["TabPage"] = "question";
                TempData["Message"] = "پرسشنامه ذخیره شد.";
                return(RedirectToPage("/Questionnaire/Index"));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblQuestionnaireExists(tblQuestionnaire.Qid))
                {
                    TempData["TabPage"] = "question";
                    TempData["Error"]   = "خطا.";
                    return(RedirectToPage("/Questionnaire/Index"));
                }
                else
                {
                    throw;
                }
            }
        }