public IHttpActionResult DeleteSessions(CustomersSessions strSession) { SessionIDManager manager = new SessionIDManager(); CustomersSessions session = m_db.Sessions.SingleOrDefault(x => x.SessionId == strSession.SessionId); bool isExpired = doesSessionExpired(strSession); if (isExpired) { manager.RemoveSessionID(HttpContext.Current); m_db.Sessions.Remove(session); m_db.SaveChanges(); return(BadRequest("Your session expierd")); } if (manager.Validate(strSession.SessionId)) { Customer customer = m_db.Customers.SingleOrDefault(x => x.Id == session.CustomerId); if (session == null || customer == null) { return(BadRequest()); } customer.LastSeenDate = session.SessionDate; customer.LastSeenTime = session.SessionTime; manager.RemoveSessionID(HttpContext.Current); m_db.Sessions.Remove(session); m_db.SaveChanges(); //return Ok(session); return(Ok("session deleted succesfully")); } return(BadRequest()); }