public IActionResult Create(Order obj) { _db.Orders.Add(obj); _db.SaveChanges(); return RedirectToAction("Index"); }
public int AddCategory(Category category) { db.Categories.Add(category); int affectedRow = db.SaveChanges(); return(affectedRow); }
/// <summary> /// Create a new database entry from the given entry /// </summary> public void Create(FormModel model) { if (_context.FormEntries.Count() >= 10) { throw new InvalidOperationException("Database bevat al 10 entries, er kunnen er geen meer worden toegevoegd tot er eerst een verwijderd wordt."); } _context.FormEntries.Add(model); _context.SaveChanges(); }
public ActionResult _Create([Bind(Include = "FormId,FirstMidName,LastName,BirthDate,PhoneNumber,Address,MilitaryService,MilitaryServiceEnum,TshirtSize,PantSize,ShoesSize,DrivingLicence,DrivingLicenceClass,ForkliftLicence,CraneOperationLicense,PrimarySchool_bool,PrimarySchool_name,SecondarySchool_bool,SecondarySchool_name,HighSchool_bool,HighSchool_name,AssociateDegree_bool,AssociateDegree_name,BachelorDegree_bool,BachelorDegree_name,MasterDegree_bool,MasterDegree_name,CourseNSeminar1_Certificate,CourseNSeminar1_Topic,CourseNSeminar2_Certificate,CourseNSeminar2_Topic,CourseNSeminar3_Certificate,CourseNSeminar3_Topic,LangInfo_eng,LangInfo_de,LangInfo_fr,LangInfo_other,LangInfo_other_name,ComputerSkill_word,ComputerSkill_excel,ComputerSkill_powerpoint,ComputerSkill_other1,ComputerSkill_other2,ComputerSkill_other3,HealthQuestion1,HealthQuestion2,HealthQuestion3,HealthQuestion4,HealthQuestion5,HealthQuestion6,LegalObstacle,WorkingNow,JobChangeReason,JobHistoryName1,JobHistoryMission1,JobHistoryWorkDays1,JobHistoryReason4Leaving1,JobHistoryName2,JobHistoryMission2,JobHistoryWorkDays2,JobHistoryReason4Leaving2,JobHistoryName3,JobHistoryMission3,JobHistoryWorkDays3,JobHistoryReason4Leaving3,Ok4Overtime,Ok4ShiftWork")] Form form) { if (ModelState.IsValid) { db.Forms.Add(form); db.SaveChanges(); return(RedirectToAction("_Index")); } return(PartialView(form)); }
public int AddProduct(Product product) { db.Products.Add(product); return(db.SaveChanges()); }