Ejemplo n.º 1
0
        public async Task <bool> SetViolation(ViolationDto violationDto, ClaimsPrincipal user)
        {
            Violation violation = _mapper.Map <ViolationDto, Violation>(violationDto);

            User policeman = await _userManager.FindByEmailFromClaimsPrincipals(user);

            return(await _policeService.SetViolation(violation, policeman));
        }
Ejemplo n.º 2
0
        public async Task <PopularResult <string> > UpdateAsync(ViolationDto dto)
        {
            var result = new PopularResult <string>();

            dto.Vehicle = null;
            var violation = ObjectMapper.Map <ViolationDto, ViolationEntity>(dto);
            await _violationRepository.UpdateAsync(violation);

            result.Success("更新成功");
            return(result);
        }
Ejemplo n.º 3
0
        public async Task <PopularResult <string> > InsertAsync(ViolationDto dto)
        {
            var result    = new PopularResult <string>();
            var entity    = ObjectMapper.Map <ViolationDto, ViolationEntity>(dto);
            var violation = await _violationRepository.InsertAsync(entity);

            if (violation == null)
            {
                result.Failed("添加失败");
                return(result);
            }
            result.Success("添加成功");
            return(result);
        }
Ejemplo n.º 4
0
 public async Task <ActionResult <bool> > SetViolation(ViolationDto violationDto)
 {
     return(await _policePresentation.SetViolation(violationDto, HttpContext.User));
 }
Ejemplo n.º 5
0
 public async Task <PopularResult <string> > UpdateAsync([FromBody] ViolationDto dto)
 {
     return(await _violationService.UpdateAsync(dto));
 }
Ejemplo n.º 6
0
 public async Task <PopularResult <string> > InsertAsync([FromBody] ViolationDto dto)
 {
     dto.Creator    = LoginUser.Id;
     dto.CreateTime = LoginUser.SysteDate;
     return(await _violationService.InsertAsync(dto));
 }