public static void Insertar <T>(T elemento) where T : class { var ctx = new TaskDbContext(); ctx.Add <T>(elemento); ctx.SaveChanges(); }
public async Task <IActionResult> Create([Bind("Id,Title")] Models.Task task) { if (ModelState.IsValid) { _context.Add(task); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(task)); }
public async Task <IActionResult> Create([Bind("CategoryID,CategoryName")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("TaskID,TaskName,DueDate,CategoryID")] Models.Task task) { if (ModelState.IsValid) { _context.Add(task); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryID"] = new SelectList(_context.Category, "CategoryID", "CategoryName", task.CategoryID); return(View(task)); }
public async Task <IActionResult> Create([Bind("AthleticsMeetingsID,MeetingName,MeetingLocation,MeetingDate,MeetingCategoryID")] AthleticsMeetings athleticsMeetings) { if (ModelState.IsValid) { _context.Add(athleticsMeetings); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MeetingCategoryID"] = new SelectList(_context.MeetingCategory, "MeetingCategoryID", "CategoryName", athleticsMeetings.MeetingCategoryID); return(View(athleticsMeetings)); }
public void Create(Login login) { context.Add(login); }
public static void InsertarSinGuardar <T>(T elemento, TaskDbContext ctx) where T : class { ctx.Add <T>(elemento); }