Beispiel #1
0
        public bool UpdateMark(string id, string mark)
        {
            int rightID;
            int rightMark;

            if (Int32.TryParse(id, out rightID) &&
                Int32.TryParse(mark, out rightMark))
            {
                if (GetFileById(rightID) != null)
                {
                    if (rightMark >= 0 &&
                        rightMark <= 10)
                    {
                        _fileDao.UpdateMark(Int32.Parse(id), Int32.Parse(mark));

                        return(true);
                    }
                    else
                    {
                        Console.WriteLine("Incorrect MARK! Mark must be between 0 and 10");
                        return(false);
                    }
                }
                else
                {
                    Console.WriteLine("Can't find file");
                    return(false);
                }
            }
            else
            {
                Console.WriteLine("Incorrect ID or MARK (not number");
                return(false);
            }
        }