public async Task <IActionResult> Edit(int id, [Bind("BusinessTransId,BusinessId,Time,Amount,Type")] BusinessTrans businessTrans)
        {
            if (id != businessTrans.BusinessTransId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(businessTrans);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BusinessTransExists(businessTrans.BusinessTransId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(businessTrans));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Business,Language")] BusinessTrans BusinessTrans)
        {
            if (id != BusinessTrans.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(BusinessTrans);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BusinessTransExists(BusinessTrans.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["Business"] = new SelectList(_context.Business, "Id", "Id", BusinessTrans.Business);
            ViewData["Language"] = new SelectList(_context.Languages, "Id", "Code", BusinessTrans.Language);
            return(View(BusinessTrans));
        }
        public async Task <IActionResult> Create([Bind("BusinessTransId,BusinessId,Time,Amount,Type")] BusinessTrans businessTrans)
        {
            if (ModelState.IsValid)
            {
                _context.Add(businessTrans);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(businessTrans));
        }
예제 #4
0
        public async Task <IActionResult> Create(int Business, [Bind("Id,Name,Description,Business,Language")] BusinessTrans BusinessTrans)
        {
            if (ModelState.IsValid)
            {
                if (Business == 0)
                {
                    Business entry = new Business(); _context.Add(entry); BusinessTrans.Business = entry.Id;
                }
                _context.Add(BusinessTrans);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["Business"] = new SelectList(_context.Business, "Id", "Id", BusinessTrans.Business);
            ViewData["Language"] = new SelectList(_context.Languages, "Id", "Code", BusinessTrans.Language);
            return(View(BusinessTrans));
        }