public async Task <ActionResult <EmployeementType> > PostEmployee(EmployeementType employeementType)
        {
            _context.EmployeementTypes.Add(employeementType);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEmployee", new { id = employeementType.Id }, employeementType));
        }
Exemple #2
0
        public void Create(CreateEmployeementTypeDto dto)
        {
            var employeementType = new EmployeementType
            {
                Title = dto.Title
            };

            _employeementTypeRepository.Insert(employeementType);
        }
        public async Task <IActionResult> PutEmployee([FromBody] EmployeementType employeementType)
        {
            if (null == employeementType.Id)
            {
                return(BadRequest());
            }

            // _context.Entry(employeementType).State = EntityState.Modified;
            _context.EmployeementTypes.Update(employeementType);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(Ok(employeementType));
        }