public IActionResult Post([FromBody] Attendee attendeeToAdd) { if (_ahcmsContext.Attendees.Where(a => a.AttendeeRFID == attendeeToAdd.AttendeeRFID).Any()) { return(ValidationProblem("RFID already registered")); } else { _ahcmsContext.Attendees.Add(attendeeToAdd); _ahcmsContext.SaveChanges(); return(Ok("Registration successful")); } }
public ActionResult Register([FromBody] AppUser registerAppUser) { if (_ahcmsContext.AppUsers.Where(a => a.Username == registerAppUser.Username).Any()) { return(Conflict("Username already registered")); } else { _ahcmsContext.AppUsers.Add(registerAppUser); _ahcmsContext.SaveChanges(); return(Ok("Registration successful")); } }
public ActionResult Post([FromBody] Attendance attendanceToAdd) { _ahcmsContext.Attendances.Add(attendanceToAdd); return(Ok(_ahcmsContext.SaveChanges())); }
public ActionResult Post([FromBody] Place placeToAdd) { _ahcmsContext.Places.Add(placeToAdd); return(Ok(_ahcmsContext.SaveChanges())); }