示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("EarningRecordId,EnteringDate,EarningType,Source,Amount,PaymentType,EnteringStaff,Branch,Note")] BrhEarningRecord brhEarningRecord)
        {
            if (id != brhEarningRecord.EarningRecordId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    //brhEarningRecord.EnteringDate = TimeZoneInfo.ConvertTime(brhEarningRecord.EnteringDate, TimeZoneInfo.FindSystemTimeZoneById("China Standard Time"));
                    _context.Update(brhEarningRecord);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BrhEarningRecordExists(brhEarningRecord.EarningRecordId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView("~/Areas/Branch/Views/BrhEarningRecord/CreateEdit.cshtml", brhEarningRecord));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("EarningRecordId,EnteringDate,EarningType,Source,Amount,PaymentType,EnteringStaff,Branch,Note")] BrhEarningRecord brhEarningRecord)
        {
            if (ModelState.IsValid)
            {
                brhEarningRecord.EnteringDate = TimeZoneInfo.ConvertTime(brhEarningRecord.EnteringDate, TimeZoneInfo.FindSystemTimeZoneById("China Standard Time"));
                _context.Add(brhEarningRecord);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView("~/Areas/Branch/Views/BrhEarningRecord/CreateEdit.cshtml", brhEarningRecord));
        }