public ActionResult Index() { var AttnData = new AttendenceDTO() { attendenceList = _db.attendences.ToList() }; //var results = (from row in _db.customers select row).ToList(); return(View(AttnData)); }
public ActionResult EditAttendence(AttendenceDTO s, int id) { attendence result = _db.attendences.Single(attendence => attendence.id == id); result.id = s.attendenceData.id; result.date = s.attendenceData.date; result.aattendence = s.attendenceData.aattendence; result.emp_id = s.attendenceData.emp_id; _db.SaveChanges(); return(RedirectToAction("Index", "Attendence")); }
public IHttpActionResult Attend(AttendenceDTO dto) { var userId = User.Identity.GetUserId(); if (_context.Attendences. Any(a => a.AttendeeId == userId && a.TourId == dto.TourId)) { return(BadRequest("You have already registered")); } var attendent = new Attendence { TourId = dto.TourId, AttendeeId = userId }; _context.Attendences.Add(attendent); _context.SaveChanges(); return(Ok()); }
public ActionResult AddAttendence(AttendenceDTO c) { _db.attendences.Add(c.attendenceData); _db.SaveChanges(); return(RedirectToAction("Index", "Attendence")); }