/// <summary> /// Add Violation (Registration) /// </summary> /// <param name="violationRequest"></param> /// <returns></returns> public async Task <BaseResponse> IssueViolation(ViolationRequest violationRequest) { try { Violation violation = new Violation() { FineId = violationRequest.FineId, ViolatorId = violationRequest.ViolatorId, IssueDate = violationRequest.IssueDate, Notes = violationRequest.Notes, Location = violationRequest.Location, Issuer = violationRequest.Issuer, IsPaid = false }; await _db.Violation.AddAsync(violation); await _db.SaveChangesAsync(); return(new BaseResponse { Message = Helper.GetResponseMessage(200) }); } catch (Exception ex) { return(new BaseResponse { Message = Helper.GetResponseMessage(500) }); } }
public async Task <BaseResponse> IssueViolation(ViolationRequest violationRequest) { return(await violatorsService.IssueViolation(violationRequest)); }