예제 #1
0
 public PaperArchieve Add(PaperArchieve paper)
 {
     try
     {
         var validator = new PaperValidator <PaperArchieve>();
         if (validator.ValidateInput(paper))
         {
             if (Get(paper.Id) == null)
             {
                 return(_paperArchieveDAL.Add(paper));
             }
             else
             {
                 throw new Exception("Paper already exist");
             }
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         throw ex.GetBaseException();
     }
 }
예제 #2
0
        public Paper Update(Paper modifiedPaper)
        {
            var validator = new PaperValidator <Paper>();

            try
            {
                if (validator.ValidateInput(modifiedPaper))
                {
                    if (Get(modifiedPaper.Id) != null)
                    {
                        return(_paperDAL.Update(modifiedPaper));
                    }
                    else
                    {
                        throw new Exception("Paper not exist");
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex.GetBaseException();
            }
        }