示例#1
0
        public async Task <IActionResult> Create(KhachHangForCreateDto khachHang)
        {
            try
            {
                var result = await _repo.Create(khachHang);

                return(StatusCode(201, new SuccessResponseDto
                {
                    Message = "Tạo " + _entityName + " mới thành công!",
                    Result = new SuccessResponseResultWithSingleDataDto
                    {
                        Data = result
                    }
                }));
            }
            catch (Exception e)
            {
                return(StatusCode(500, new FailedResponseDto
                {
                    Message = "Tạo " + _entityName + " mới thất bại!",
                    Result = new FailedResponseResultDto
                    {
                        Errors = e
                    }
                }));
            }
        }
示例#2
0
 public void Create(KhachHangDTO khachhang)
 {
     khachhangRepository.Create(iMapper.Map <KhachHangDTO, KhachHang>(khachhang));
 }
示例#3
0
 public bool Create(KhachHangModel model)
 {
     return(_res.Create(model));
 }