public IHttpActionResult Posthr(hr hr)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.hr.Add(hr);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (hrExists(hr.login))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(Ok());
        }
        public IHttpActionResult Deletehr(string id)
        {
            hr hr = db.hr.Find(id);

            if (hr == null)
            {
                return(NotFound());
            }

            db.hr.Remove(hr);
            db.SaveChanges();

            return(Ok(hr));
        }
Esempio n. 3
0
        internal static void VisualizeModelNode(this IModelNode?modelNode)
        {
            _ = modelNode ?? throw new ArgumentNullException(nameof(modelNode));
            var xml       = UserDifferencesHelper.GetUserDifferences(modelNode)[""];
            var prettyXml = new XmlFormatter().Format(xml);
            var encode    = WebUtility.HtmlEncode(prettyXml);
            var html      = @$ "
<html>
    <head>
        <link href='https://unpkg.com/[email protected]/themes/prism-okaidia.css' rel='stylesheet' />
    </head>
    <body style='background-color: #272822; color: #bbb; font-family: sans-serif; margin: 0; padding: 0;'>
        <h1 style='text-align: center; margin-top: .5rem'>XAF Layout Inspector</h1>
        <hr style='border: none; border-top: 1px solid #bbb;' />
        <pre><code class='language-xml'>{encode}</code></pre>