Пример #1
0
        public void Create(NhanVienCreate input)
        {
            if (userServices.GetAll().Any(p => p.TenTaiKhoan == input.TenTaiKhoan))
            {
                input.TrangThai = 1; //default

                _repositoryNhanVien.Insert(new NhanViens {
                    TenTaiKhoan = input.TenTaiKhoan,
                    TenNhanVien = input.TenNhanVien,
                    ChucVu      = input.ChucVu,
                    DiaChi      = input.DiaChi,
                    Email       = input.Email,
                    NgaySinh    = input.NgaySinh,
                    NgayBatDau  = input.NgayBatDau,
                    SoDienThoai = input.SoDienThoai,
                    TrangThai   = input.TrangThai
                });
                lichSuServices.Create(new LichSu
                {
                    HanhDong     = Constant.CreateAction,
                    TenTaiKhoan  = userServices.GetCurrentUser().UserName,
                    NoiDung      = Constant.CvtToString(input),
                    ViTriThaoTac = Constant.NhanVien
                });
            }
            else
            {
                //throw Response
            }
        }
 public IHttpActionResult Create(NhanVienCreate input)
 {
     _nhanVienServices.Create(input);
     return(Ok(new
     {
         obj = input,
         message = "success"
     }));
 }