Hello there. I am drawing data from the database according to a certain condition. however, the query repeats data in some cases and lists duplicate data. How do I prevent this?
TekrarAraV View;
- public ActionResult TekrarAraV(DateTime? date)
- {
- userData = userControl(); ViewBag.uData = userData;
- string userName = userData.tmkName;
-
- using (smartCMSEntities ft = new smartCMSEntities())
- {
- string userRol = userData.role;
- ViewBag.userRoler = userRol;
-
-
- if (date == null && userRol == "admin")
- {
- return View(ft.vw_get_callLog.Where(x => x.firstStatusText == "Tekrar Ara" & x.callDate != null & x.callDate == DateTime.Today).ToList());
- }
-
- else if (date == null)
- {
- return View(ft.vw_get_callLog.Where(x => x.firstStatusText == "Tekrar Ara" & x.callDate != null & x.tmkName == userName & x.callDate == DateTime.Today).ToList());
- }
-
- else if (userRol == "admin")
- {
- return View(ft.vw_get_callLog.Where(x => x.firstStatusText == "Tekrar Ara" & x.callDate != null & x.callDate == date).ToList());
- }
- else
- {
- return View(ft.vw_get_callLog.Where(x => x.firstStatusText == "Tekrar Ara" & x.callDate != null & x.tmkName == userName & x.callDate == date).ToList());
- }
-
- }
- }