Example #1
0
        //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());
        }
Example #2
0
        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();
     }
 }
Example #4
0
        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");
        }
Example #5
0
 public IActionResult Add(WorkerModel model)
 {
     repo.Add(model);
     return(RedirectToAction("Index"));
 }