public async Task <IActionResult> Delete([FromBody] Nhanvien model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //1. business logic
                    //set Active to 0

                    //2. logically delete object
                    await repository.Delete(model.MaNv);

                    var novaticResponse = NovaResponse.SUCCESS(model);
                    return(Ok(novaticResponse));
                }
                catch (Exception ex)
                {
                    if (ex.GetType().FullName == "Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException")
                    {
                        return(NotFound());
                    }

                    return(BadRequest());
                }
            }
            return(BadRequest());
        }
        public async Task <IActionResult> Search(string keyword)
        {
            try
            {
                var dataList = await repository.Search(keyword);

                if (dataList == null || dataList.Count == 0)
                {
                    return(NotFound());
                }

                var novaticResponse = NovaResponse.SUCCESS(dataList.Cast <object>().ToList());
                return(Ok(novaticResponse));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
        public async Task <IActionResult> List()
        {
            try
            {
                var dataList = await repository.List();

                if (dataList == null || dataList.Count == 0)
                {
                    return(NotFound());
                }

                var reponse = NovaResponse.SUCCESS(dataList.Cast <object>().ToList());
                //var response = Newtonsoft.Json.JsonConvert.SerializeObject(novaticResponse);
                return(Ok(reponse));
            }
            catch (Exception e)
            {
                return(BadRequest());
            }
        }
        public async Task <IActionResult> Detail(int?Id)
        {
            if (Id == null)
            {
                return(BadRequest());
            }

            try
            {
                var dataList = await repository.Detail(Id);

                if (dataList == null || dataList.Count == 0)
                {
                    return(NotFound());
                }

                var novaticResponse = NovaResponse.SUCCESS(dataList.Cast <object>().ToList());
                return(Ok(novaticResponse));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }