public int InsertReportUserMentor(ReportUserMentor ReportUserMentor) { using (SqlConnection con = new SqlConnection(_ConnectionString.Value.ConnectionString)) { con.Open(); SqlTransaction sqltrans = con.BeginTransaction(); var param = new DynamicParameters(); param.Add("@Id", ReportUserMentor.Id); param.Add("@Comment", ReportUserMentor.Comment); param.Add("@PeriodId", ReportUserMentor.PeriodId); param.Add("@UserAllocationId", ReportUserMentor.UserMentorId); param.Add("@UserId", ReportUserMentor.UserId); param.Add("@StatusId", ReportUserMentor.StatusId); var result = con.Execute("InsertUpdateReportUserMentor", param, sqltrans, 0, System.Data.CommandType.StoredProcedure); if (result > 0) { sqltrans.Commit(); } else { sqltrans.Rollback(); } return(result); } }
public IActionResult MarkUserMentor(ReportUserMentor Mentor) { try { if (ModelState.IsValid) { _IReport.InsertReportUserMentor(Mentor); return(RedirectToAction("Index")); } return(View(Mentor)); } catch { return(View()); } }