public async Task <IActionResult> CreateEmployeePrivilegeAsync([FromBody] EmployeePrivilegeViewModel value)
        {
            var response = new SingleModelResponse <EmployeePrivilegeViewModel>() as ISingleModelResponse <EmployeePrivilegeViewModel>;

            try
            {
                var entity = await Task.Run(() =>
                {
                    return(_RESTfulAPI_Repository.AddEmployeePrivilege(value.ToEntity()));
                });


                if (response.DidError == false)
                {
                    response.Model = entity.ToViewModel();
                }
            }
            catch (Exception ex)
            {
                string webRoot   = _hostingEnvironment.WebRootPath;
                string errorGuid = String.Format(Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 16));

                HttpContext.Session.SetString("ErrorGuid", errorGuid);
                ViewBag.ErrorGuid = HttpContext.Session.GetString("ErrorGuid");

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    using (StreamWriter w = new StreamWriter(webRoot + "\\log.txt", append: true))
                    {
                        Log.Logging(ex.ToString(), w, ViewBag.ErrorGuid);
                    }
                }

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                {
                    using (StreamWriter w = new StreamWriter(webRoot + "/log.txt", append: true))
                    {
                        Log.Logging(ex.ToString(), w, ViewBag.ErrorGuid);
                    }
                }


                response.DidError = true;
                //response.ErrorMessage = ex.ToString();


                return(this.Json(new { timestamp = DateTime.Now, errorGuid = ViewBag.ErrorGuid, status = HttpStatusCode.InternalServerError, info = "Error logged in log file." }));
            }

            //
            //
            response.Info = "Client " + " " + HttpContext.Connection.RemoteIpAddress.ToString();

            return(response.ToHttpResponse());
        }
        public async Task <IActionResult> UpdateEmployeePrivilegeAsync(Int32 id, [FromBody] EmployeePrivilegeViewModel value)
        {
            var response = new SingleModelResponse <EmployeePrivilegeViewModel>() as ISingleModelResponse <EmployeePrivilegeViewModel>;

            try
            {
                var entity = await Task.Run(() =>
                {
                    return(_RESTfulAPI_Repository.UpdateEmployeePrivilege(id, value.ToEntity()));
                });



                response.Model = entity.ToViewModel();
                response.Info  = "The record was updated successfully";
            }
            catch (Exception ex)
            {
                response.DidError     = true;
                response.ErrorMessage = ex.Message;
            }

            return(response.ToHttpResponse());
        }