Example #1
0
 public DelProductInfoResponse DelProductInfo(DelProductInfoRequest request)
 {
     return((DelProductInfoResponse)Service <DelProductInfoResponse>(() => {
         if (request == null)
         {
             throw new Exception("null input!");
         }
         using (IUnitOfWork unitOfWork = RepositoryFactory.GetUnitOfWork())
         {
             IProductInfoRepository productInfoRepository = (IProductInfoRepository)RepositoryFactory
                                                            .Get(typeof(IProductInfoRepository), unitOfWork);
             ProductInfo delProductInfo = productInfoRepository.GetAll().Include("InstallInfoes").Include("MaintanceRecords").Include("ProductAddtionalInfoes")
                                          .Where(it => it.Id == request.ProductId).FirstOrDefault();
             if (delProductInfo == null)
             {
                 throw new Exception("不存在或已删除的产品信息!");
             }
             //if (delProductInfo.InstallInfoes != null)
             //{
             //    IInstallInfoRepository installInfoRepository = (IInstallInfoRepository)RepositoryFactory
             //        .Get(typeof(IInstallInfoRepository), unitOfWork);
             //}
             //if (delProductInfo.MaintanceRecords != null)
             //{ }
             //if (delProductInfo.ProductAddtionalInfoes != null)
             //{ }
             productInfoRepository.Del(delProductInfo);
             unitOfWork.Commit();
             return new DelProductInfoResponse()
             {
                 IsSucess = true, Message = ""
             };
         }
     }));
 }