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(); } }
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 }); }
public RelationRequestDAL(RelationRequest Pa) { _RelationRequest = Pa; }
public RelationRequestDAL(int Id) { Db = new SOKNAEntities(); _RelationRequest = Db.RelationRequest.Single(r => r.Id == Id); }
public RelationRequestDAL() { _RelationRequest = new RelationRequest(); }
public SuccessResponse Delete(RelationRequest request) { return(_dealerService.RemoveSaucer(request)); }
public SuccessResponse Post(RelationRequest request) { return(_dealerService.AddSaucer(request)); }
public SuccessResponse Delete(RelationRequest request) { return(_branchService.RemoveDealer(request)); }
public SuccessResponse Post(RelationRequest request) { return(_branchService.AddDealer(request)); }
// 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); }