public SuccessResponse RemoveSaucer(RelationRequest request)
 {
     try
     {
         var dealerSaucer = _dealerSaucerRepository.FindBy(dealerSaucerRe => dealerSaucerRe.DealerId == request.FirstReference && dealerSaucerRe.SaucerId == request.SecondReference).FirstOrDefault();
         dealerSaucer.ThrowExceptionIfRecordIsNull();
         _dealerSaucerRepository.Remove(dealerSaucer);
         return(new SuccessResponse {
             IsSuccess = true
         });
     }
     catch (DataAccessException)
     {
         throw new ApplicationException();
     }
 }
 public SuccessResponse AddSaucer(RelationRequest request)
 {
     try
     {
         var dealerSaucer = TypeAdapter.Adapt <DealerSaucer>(request);
         _dealerSaucerValidator.ValidateAndThrowException(dealerSaucer, "Base");
         _dealerSaucerRepository.Add(dealerSaucer);
         return(new SuccessResponse {
             IsSuccess = true
         });
     }
     catch (DataAccessException)
     {
         throw new ApplicationException();
     }
 }
示例#3
0
 public ResponseMessage <int> addRelation([FromBody] RelationRequest reqMsg)
 {
     _sysUserAppRoleService.ClearRelation(reqMsg.user_id, reqMsg.app_id, reqMsg.group_id);
     foreach (var item in reqMsg.role_id)
     {
         var insertobj = new SysUserAppRole()
         {
             user_id  = reqMsg.user_id,
             app_id   = reqMsg.app_id,
             group_id = reqMsg.group_id,
             role_id  = item
         };
         _sysUserAppRoleService.Insert(insertobj);
     }
     return(new ResponseMessage <int> {
         data = 1
     });
 }
示例#4
0
 public RelationRequestDAL(RelationRequest Pa)
 {
     _RelationRequest = Pa;
 }
示例#5
0
 public RelationRequestDAL(int Id)
 {
     Db = new SOKNAEntities();
     _RelationRequest = Db.RelationRequest.Single(r => r.Id == Id);
 }
示例#6
0
 public RelationRequestDAL()
 {
     _RelationRequest = new RelationRequest();
 }
示例#7
0
 public SuccessResponse Delete(RelationRequest request)
 {
     return(_dealerService.RemoveSaucer(request));
 }
示例#8
0
 public SuccessResponse Post(RelationRequest request)
 {
     return(_dealerService.AddSaucer(request));
 }
示例#9
0
 public SuccessResponse Delete(RelationRequest request)
 {
     return(_branchService.RemoveDealer(request));
 }
示例#10
0
 public SuccessResponse Post(RelationRequest request)
 {
     return(_branchService.AddDealer(request));
 }
示例#11
0
        // Relation endpoint
        // If we have multi-route for the same class, it seems we need to check on an invalid ID
        // so create a new request for specific relation
        public List <Relation> Get(RelationRequest request)
        {
            var result = _database.RelationsData(_dbFactory);

            return(result);
        }