Beispiel #1
0
        public ActionResult Edit(string id)
        {
            var streamReader   = new StreamReader(_context.Request.InputStream);
            var jsonSerializer = new JsonSerializer();
            var scheduleModel  = jsonSerializer.Deserialize <ScheduleModel>(new JsonTextReader(streamReader));

            if (
                _moviePersistence.GetAll()
                .All(
                    movie =>
                    string.Compare(movie.ID, scheduleModel.MovieID, StringComparison.InvariantCultureIgnoreCase) !=
                    0))
            {
                return(Error());
            }

            if (
                _roomPersistence.GetAll()
                .All(
                    room =>
                    string.Compare(room.ID, scheduleModel.RoomID, StringComparison.InvariantCultureIgnoreCase) !=
                    0))
            {
                return(Error());
            }

            if (_schedulePersistence.Edit(id, scheduleModel) == PersistenceCodes.IdNotFound)
            {
                return(Error());
            }

            return(Ok());
        }