public ResultObject Create([FromBody] SampleRequestDto request)
        {
            if (ModelState.IsValid)
            {
                var data     = _requestRepository.SaveAndGetId(_mapper.Map <SampleRequest>(request));
                var response = new ResultObject()
                {
                    success  = data != null ? true:false,
                    data     = data,
                    messages = ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage).ToList()
                };

                if (response.success)
                {
                    _emailService.SendNotificationResponsibleUser(data.Value);
                }
                return(response);
            }

            return(new ResultObject()
            {
                success = false,
                messages = ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage).ToList()
            });
        }
 public ResultObject Update([FromBody] SampleRequestDto request)
 {
     if (ModelState.IsValid)
     {
         var data = _requestRepository.Update(_mapper.Map <Models.Models.Entities.SampleRequest>(request));
         return(new ResultObject()
         {
             success = data,
             data = data,
             messages = ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage).ToList()
         });
     }
     return(new ResultObject()
     {
         success = false,
         messages = ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage).ToList()
     });
 }