public ActionResult AcceptOpenShift(string From, string Body) { var response = new TwilioResponse(); var employee = _employeeRepository.Select().Where(e => e.PhoneNumber == From).FirstOrDefault(); if (employee == null) { return(TwiML(response)); } //parse and process sms message body var parameters = Body.Split(' '); if (parameters.Count() < 2) { response.Message("Whoops. Not sure what that command was. Try again."); } if (parameters[0].ToLower() == "yes") { var openShift = _shiftRepository.Select().Where(s => s.ID.ToString() == parameters[1]).FirstOrDefault(); if (openShift.AssignedEmployee == null) { openShift.AssignedEmployee = employee; _shiftRepository.Update(openShift); _shiftRepository.Save(); var message = string.Format( "Awesome. Thanks for stepping up. See you on {0} at {1}", openShift.StartTime.ToLongDateString(), openShift.StartTime.ToShortTimeString() ); response.Message(message); } else { response.Message("Ohhh, so close. Try again next time"); } } return(TwiML(response)); }
public DbResult Update(Shift entity, string flag) { return(repo.Update(entity, flag)); }