public int UpdateUserMentor(UserMentor UserMentor) { using (SqlConnection con = new SqlConnection(_ConnectionString.Value.ConnectionString)) { con.Open(); SqlTransaction sqltrans = con.BeginTransaction(); var param = new DynamicParameters(); param.Add("@Id", UserMentor.Id); param.Add("@UserId", UserMentor.UserId); param.Add("@MentorId", UserMentor.MentorId); param.Add("@TrainingCategoryId", UserMentor.TrainingCategoryId); param.Add("@Comment", UserMentor.Comment); var result = con.Execute("InsertUpdateUserMentor", param, sqltrans, 0, System.Data.CommandType.StoredProcedure); if (result > 0) { sqltrans.Commit(); } else { sqltrans.Rollback(); } return(result); } }
public IActionResult DeleteUserMentor(int Id, UserMentor usermentor) { try { _IMentor.DeleteUserMentor(usermentor.Id); return(RedirectToAction("UserMentor")); } catch (Exception ex) { return(View()); } }
public IActionResult Create(UserMentor usermentor) { try { _IMentor.InsertUserMentor(usermentor); return(RedirectToAction("UserMentor")); } catch (Exception ex) { return(View()); } }
private void AddMentor_Clicked(object sender, EventArgs e) { var dbpath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Guidemate.db"); var db = new SQLiteConnection(dbpath); db.CreateTable <UserMentor>(); var UserMentor = new UserMentor() { userName = UserName.Text, mentorUserName = MentorUserName.Text }; db.Insert(UserMentor); Console.WriteLine(UserMentor.mentorUserName); }