示例#1
0
        public async Task <ActionResult> Create(ServiceCreateDTO Service)
        {
            var result = await _ServiceService.Create(Service);

            return(CreatedAtAction(
                       "GetById",
                       new { id = result.ServiceId },
                       result));
        }
        public async Task <ServiceDTO> Create(ServiceCreateDTO model)
        {
            var entry = new Service
            {
                ServiceId   = model.ServiceId,
                Name        = model.Name,
                Description = model.Description,
                Price       = model.Price
            };

            await _context.AddAsync(entry);

            await _context.SaveChangesAsync();

            return(_mapper.Map <ServiceDTO>(entry));
        }