public async Task <ManagerConfirmation> CreateManagerAsync(ManagerPostBody managerToPostBody) { Manager newManager = new() { Id = Guid.NewGuid(), Name = managerToPostBody.Name, LastName = managerToPostBody.LastName, Contact = managerToPostBody.Contact, Email = managerToPostBody.Email, JMBG = managerToPostBody.JMBG, City = managerToPostBody.City, Address = managerToPostBody.Address, Password = managerToPostBody.Password }; await _context.Set <Manager>().AddAsync(newManager); await _context.SaveChangesAsync(); _logger.LogInformation("CreateManagersAsync() Executed!"); return(await Task.FromResult(_mapper.Map <ManagerConfirmation>(newManager))); }
public async Task <ActionResult <ManagerConfirmation> > PostManager([FromBody] ManagerPostBody newManagerBody) { var managerConfirmation = await _service.CreateManagerAsync(newManagerBody); return(CreatedAtAction(nameof(GetManagerById), new { managerId = managerConfirmation.Id }, managerConfirmation)); }