コード例 #1
0
 public OperationResult <bool> Create(Region item)
 {
     try
     {
         if (_dao.List().Any(x => x.Name.ToLower().Trim() == item.Name.ToLower().Trim() && !x.IsDeleted))
         {
             return new OperationResult <bool>()
                    {
                        Success = true, Result = false, Message = "Name already exists"
                    }
         }
         ;
         _dao.Create(item);
         return(new OperationResult <bool>()
         {
             Success = true, Result = true
         });
     }
     catch (Exception e)
     {
         return(new OperationResult <bool>()
         {
             Success = false, Exception = e
         });
     }
 }
コード例 #2
0
 public OperationResult Create(Region item)
 {
     try
     {
         _dao.Create(item);
         return(new OperationResult()
         {
             Success = true
         });
     }
     catch (Exception e)
     {
         return(new OperationResult()
         {
             Success = false, Exception = e
         });
     }
 }