Ejemplo n.º 1
0
        //Yeni Calisan ekler
        public async Task <ServiceResponse <CalisanGetirDto> > EkleCalisan(CalisanEkleDto yeniCalisan)
        {
            ServiceResponse <CalisanGetirDto> response = new ServiceResponse <CalisanGetirDto>();

            Calisan calisan = _mapper.Map <Calisan>(yeniCalisan);

            await _context.Calisanlar.AddAsync(calisan);

            await _context.SaveChangesAsync();

            Calisan calisanEkle = await _context.Calisanlar
                                  .Where(c => c.Id == calisan.Id)
                                  .Include(c => c.Firma)
                                  .Include(c => c.CalisanDepartmanlari).ThenInclude(cd => cd.Departman)
                                  .FirstOrDefaultAsync();

            response.data  = _mapper.Map <CalisanGetirDto>(calisanEkle);
            response.Mesaj = "Kayit Basariyla Eklendi";
            return(response);
        }
Ejemplo n.º 2
0
 public async Task <ActionResult <CalisanGetirDto> > EkleCalisan(CalisanEkleDto yeniCalisan)
 {
     return(Ok(await _calisanService.EkleCalisan(yeniCalisan)));
 }