Beispiel #1
0
        public ExeResult Update(PublisherModel model)
        {
            message.Clear();
            if (model.Name.Length > MaxNameSize)
            {
                message.Add($"Long name >{MaxNameSize}.");
            }

            var publish = ControlTools.MapTo <PublisherModel, Publisher>(model);
            var result  = ControlTools.DbExec(_repository.Update, publish, "Publisher not update");

            return(result);
        }
Beispiel #2
0
        public ExeResult Update(GameModel model)
        {
            ExeResult exRes = AllValidationWithErrorMessge(model);

            if (exRes.IsError)
            {
                return(exRes);
            }

            var game = ControlTools.MapTo <GameModel, Games>(model);

            exRes = ControlTools.DbExec(_repository.Update, game, "Game not update");
            return(exRes);
        }
Beispiel #3
0
        public ExeResult Delete(PublisherModel model)
        {
            if (_repository.GetById(model.Id) == null)
            {
                return(new ExeResult(new List <string>()
                {
                    "This publisher is unknown."
                }));
            }

            var publisher = ControlTools.MapTo <PublisherModel, Publisher>(model);
            var result    = ControlTools.DbExec(_repository.Delete, publisher, "Genre not delete");

            return(result);
        }
Beispiel #4
0
        public ExeResult Delete(GameModel model)
        {
            if (_repository.GetById(model.Id) == null)
            {
                return(new ExeResult(new List <string>()
                {
                    "This game is unknown."
                }));
            }

            var game   = ControlTools.MapTo <GameModel, Games>(model);
            var result = ControlTools.DbExec(_repository.Delete, game, "Game not delete");

            return(result);
        }
        public ExeResult Delete(GenreModel genreToDB)
        {
            message.Clear();
            if (_repository.GetById(genreToDB.Id) == null)
            {
                return(new ExeResult(new List <string>()
                {
                    "This genre is unknown."
                }));
            }

            var genre  = ControlTools.MapTo <GenreModel, Genres>(genreToDB);
            var result = ControlTools.DbExec(_repository.Delete, genre, "Genre not delete");

            return(result);
        }
        public ExeResult Update(GenreModel genreToDB)
        {
            message.Clear();
            //Нужна ли эта проверка
            //if (_repository.GetById(genreToDB.Id) == null) message.Add("This genre is unknown.");

            ValidationCharacterLenght(genreToDB);
            if (message.Count != 0)
            {
                return(new ExeResult(message));
            }

            var genre  = ControlTools.MapTo <GenreModel, Genres>(genreToDB);
            var result = ControlTools.DbExec(_repository.Update, genre, "Genre not update");

            return(result);
        }