public async Task Delete(string id)
        {
            var employeeModel = await _context.Set <T>().FindAsync(id);

            _context.Set <T>().Remove(employeeModel);
            await _context.SaveChangesAsync();
        }
 public async Task Create( EmployeeModel employeeModel)
 {
     
         _context.Add(employeeModel);
         await _context.SaveChangesAsync();
        
    
 }
示例#3
0
        public async Task <IActionResult> Create([Bind("Name,Email,Password,ConfirmPassword,Address,Phone")] RegisterModel registerModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(registerModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }
            return(RedirectToAction(nameof(HomeController.Index), "Home"));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("Name,RollNo,Class,Sec,EnglishM,MathsM,ScienceM,ID")] LqStudentModel lqStudentModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lqStudentModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(lqStudentModel));
        }
        public async Task <IActionResult> Create([Bind("ID,ProductName,ImgUrl,Price,Description")] LaptopModel laptopModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(laptopModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(laptopModel));
        }