public IActionResult Get()
        {
            ServicesRunningOnTMS updatetServices = db.RunningServices.SingleOrDefault(x => x.TMS_Id == 1 && x.ServiceId == 1);

            updatetServices.Status = "Test";
            if (!ModelState.IsValid)
            {
                return(BadRequest("det er her det feiler: " + ModelState));
            }

            /* if (id != product._id)
             * {
             *   return BadRequest("Sorry, seems something wrong. Couldn't deter mine record to update.");
             * }*/



            db.Entry(updatetServices).State = EntityState.Modified;
            db.SaveChanges();



            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }



            _messageHubContext.Clients.All.SendAsync("Send", "Denne servicen har stoppet");
            //var updateted = db.TMS.Find(1);


            return(Ok("Hei hei fra controller"));
        }
Exemple #2
0
 public virtual void Update(T entity)
 {
     dbSet.Attach(entity);
     dataContext.Entry(entity).State = EntityState.Modified;
 }