public UpInOut DeleteUpInOut(int id)
        {
            UpInOut upInOut = db.UpInOut.Find(id);

            if (upInOut == null)
            {
                _loggerService.CreateLog("Jordan", "UpInOut", "Delete", string.Empty, $"UpInOut {id} not found to delete.");
                return(null);
            }

            try
            {
                db.UpInOut.Remove(upInOut);
                db.SaveChanges();

                _loggerService.CreateLog("Jordan", "UpInOut", "Delete", upInOut.ToString());
            }
            catch (Exception e)
            {
                _loggerService.CreateLog("Jordan", "UpInOut", "Delete", upInOut.ToString(), "Error deleting upInOut: " + e.Message);
                return(null);
            }

            return(upInOut);
        }
        public UpInOut InsertUpInOut(UpInOut upInOut)
        {
            try
            {
                upInOut.CreatedDateTime = DateTime.Now;
                db.UpInOut.Add(upInOut);
                db.SaveChanges();

                _loggerService.CreateLog("Jordan", "UpInOut", "Create", upInOut.ToString());

                return(upInOut);
            }
            catch (Exception e)
            {
                _loggerService.CreateLog("Jordan", "UpInOut", "Create", upInOut.ToString(), "Error creating this record: " + e.Message);
                return(null);
            }
        }
        public IHttpActionResult Update(int id, UpInOut upInOut)
        {
            _loggerService.CreateLog(_user, "API", "UpInOutController", "UpInOut", "Update", upInOut.ToString(), null);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != upInOut.Id)
            {
                return(BadRequest("The Id's do not match"));
            }

            var updatedUpInOut = _upInOutRepository.UpdateUpInOut(upInOut);

            if (updatedUpInOut == null)
            {
                return(BadRequest("There was a problem updating your record. Please try again"));
            }

            return(Ok($"api/upInOut?id={upInOut.Id}"));
        }
        public IHttpActionResult Insert(UpInOut upInOut)
        {
            _loggerService.CreateLog(_user, "API", "UpInOutController", "UpInOut", "Insert", upInOut.ToString(), null);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var createdUpInOut = _upInOutRepository.InsertUpInOut(upInOut);

            if (createdUpInOut == null)
            {
                BadRequest("There was a problem inserting your record. Please try again.");
            }

            return(Created($"api/upInOut?id={createdUpInOut.Id}", createdUpInOut));
        }