示例#1
0
        public virtual T Create(T entity)
        {
            T et = _dbContext.Add(entity).Entity;

            _dbContext.SaveChanges();
            return(et);
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,ProjectName,ProjectCode,Notes,PaymentMode,Receipt,TotalTranslationsValue,Discount,TotalValue,CreatedOn,ClientId")] Project project)
        {
            if (ModelState.IsValid)
            {
                _context.Add(project);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Clients, "Id", "Name", project.ClientId);
            return(View(project));
        }