// This is the Insert method to insert the entered FormaDePago item // USAGE: <asp:FormView InsertMethod="InsertItem"> public void InsertItem() { using (_db) { var item = new RHApp.Models.FormaDePago(); item.FechaCreacion = DateTime.Now; TryUpdateModel(item); if (ModelState.IsValid) { // Save changes _db.FormaDePagoes.Add(item); _db.SaveChanges(); Response.Redirect("Default"); } } }