Exemple #1
0
        public void EditAward(Guid id, string newTitle)
        {
            if (!File.Exists(GetAwardById(id)))
            {
                throw new FileNotFoundException(
                          string.Format("File with name {0} at path {1} isn`t created!",
                                        id, JSON_AWARDS_PATH));
            }
            Award award = JsonConvert.DeserializeObject <Award>(File.ReadAllText(GetAwardById(id)));

            award.EditAward(newTitle);
            File.WriteAllText(GetAwardById(id), JsonConvert.SerializeObject(award));
        }