Exemple #1
0
 // POST api/<controller>
 public HttpStatusCodeResult Post([FromBody] UTLog value)
 {
     if (!ModelState.IsValid)
     {
         var errors = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception);
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, string.Join(" | ", errors)));
     }
     value.LogAt = DateTime.UtcNow;
     dal.Add <UTLog>(value);
     return(new HttpStatusCodeResult(HttpStatusCode.OK));
 }
Exemple #2
0
        // POST api/<controller>
        public HttpStatusCodeResult Post([FromBody] ProcessView value)
        {
            if (!ModelState.IsValid)
            {
                var errors = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception);
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, string.Join(" | ", errors)));
            }
            ProcessLog log = new ProcessLog();

            log.Type      = value.Type;
            log.ProcessID = dal.GetEntities <Process>(c => c.name == value.ProcessName).FirstOrDefault().id;
            log.FkId      = value.FkId;
            log.LogAT     = DateTime.UtcNow;
            dal.Add <ProcessLog>(log);
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }