コード例 #1
0
        public async Task <IActionResult> EditPost(string id, [Bind("EmpId,SeqNo,ChaDt,Lcb")] Tblsalary tblsalary)
        {
            if (id != tblsalary.EmpId)
            {
                return(Json("Not Found"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblsalary);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException dbex)
                {
                    if (!TblsalaryExists(tblsalary.EmpId))
                    {
                        return(Json("Not Found"));
                    }
                    else
                    {
                        return(Json(dbex.Message + " - " + dbex.StackTrace));
                    }
                }
                catch (Exception ex) {
                    return(Json(ex.Message + " - " + ex.StackTrace));
                }
                return(Json(""));
            }
            return(Json("Not valid Model"));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(string id, [Bind("EmpId,SeqNo,ChaDt,NotDr,BltNm,BltDt,LstNm,LstDt,DonAp,ReaDr,Lcb")] Tblsalary tblsalary)
        {
            if (id != tblsalary.EmpId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblsalary);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblsalaryExists(tblsalary.EmpId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblsalary));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("EmpId,SeqNo,ChaDt,Lcb")] Tblsalary tblsalary)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblsalary);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblsalary));
        }
コード例 #4
0
        public IActionResult CreateEmpId(string EmpId, int SeqNo)
        {
            var _e = _context.Tblsalary.Where(x => x.EmpId == EmpId).OrderByDescending(x => x.SeqNo).FirstOrDefault();

            SeqNo = _e == null ? 1 : _e.SeqNo + 1;
            var _m = new Tblsalary()
            {
                EmpId = EmpId, SeqNo = SeqNo
            };

            return(View("Create", _m));
        }
コード例 #5
0
        public async Task <IActionResult> CreatePost([Bind("EmpId,SeqNo,ChaDt,NotDr,BltNm,BltDt,LstNm,LstDt,DonAp,ReaDr,Lcb")] Tblsalary tblsalary)
        {
            try {
                if (ModelState.IsValid)
                {
                    _context.Add(tblsalary);
                    await _context.SaveChangesAsync();

                    return(Json(""));
                }
                return(Json("Not valid Model"));
            } catch (Exception ex) {
                return(Json(ex.Message + " - " + ex.StackTrace));
            }
        }