public bool Update(int id, string title, string material)
 {
     if (_medalDao.ShowById(id) != null)
     {
         if (!String.IsNullOrEmpty(title))
         {
             if (!String.IsNullOrEmpty(material))
             {
                 var medal = new Medal
                 {
                     Id       = id,
                     Title    = title,
                     Material = material
                 };
                 _medalDao.Update(medal);
                 return(true);
             }
             else
             {
                 throw new ArgumentNullException("You can't add medal to null material");
             }
         }
         else
         {
             throw new ArgumentNullException("You can't update medal to null title");
         }
     }
     else
     {
         throw new Exception($"Medal with id = {id} not available");
     }
 }
Beispiel #2
0
 public void Update(int id, string name, string material)
 {
     if (_medalDao.GetById(id) == null)
     {
         throw new Exception($"Medal with id = {id} not available");
     }
     else
     {
         if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(material))
         {
             throw new ArgumentNullException("It is not possible to UPDATE a medal without a name or material.");
         }
         else
         {
             _medalDao.Update(id, name, material);
         }
     }
 }
 public void Update(int id, string name, string material)
 {
     _medalDao.Update(id, name, material);
 }