//Thêm Brand mới vào bảng Line public async Task <bool> Add(WorkerDto model) { var Line = _mapper.Map <Worker>(model); _repoWorker.Add(Line); return(await _repoWorker.SaveAll()); }
public async Task <bool> AddAsync(WorkerDTO workerDTO) { var worker = _mapper.Map <WorkerDTO, Worker>(workerDTO); var result = await _workerRepository.Add(worker); return(result); }
public CreateResponse Create(WorkerRequest request) { try { var worker = TypeAdapter.Adapt <Worker>(request); _workerValidator.ValidateAndThrowException(worker, "Base"); _workerRepository.Add(worker); return(new CreateResponse(worker.Id)); } catch (DataAccessException) { throw new ApplicationException(); } }
public string AddWorker(int coordinatorId, AddWorkerDto addWorkerDto) { if (!addWorkerDto.Validate()) { return("Validation error!"); } var worker = _workerConverter.FromAddWorkerDtoToWorker(addWorkerDto); worker.IsDeleted = false; worker.CoordinatorId = coordinatorId; _workerRepository.Add(worker); return($"Worker with id {worker.Id} was succesfuly deleted"); }
public IActionResult Add(WorkerModel model) { repo.Add(model); return(RedirectToAction("Index")); }