Exemple #1
0
 public IActionResult UpdateWorkplaceParameter([FromBody] WorkplaceParameter workplaceParameter)
 {
     if (workplaceParameter == null)
     {
         return(BadRequest());
     }
     WorkplaceParameterDB.Update(workplaceParameter);
     WorkplaceParameterDB.Save();
     return(Ok(workplaceParameter));
 }
Exemple #2
0
        public IActionResult DeleteWorkplaceParameter(int id)
        {
            WorkplaceParameter workplaceParameter = WorkplaceParameterDB.GetEntity(id);

            if (workplaceParameter == null)
            {
                return(NotFound());
            }
            WorkplaceParameterDB.Delete(id);
            WorkplaceParameterDB.Save();
            return(Ok(workplaceParameter));
        }
Exemple #3
0
        public IActionResult CreateWorkplaceParameter([FromBody] WorkplaceParameter workplaceParameter)
        {
            string userJWTId = User.FindFirst("id")?.Value;
            Client client    = clientDB.GetCurrentClient(userJWTId);

            if (client != null)
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest());
                }

                workplaceParameter.ClientId = client.Id;

                WorkplaceParameterDB.Create(workplaceParameter);

                return(Ok(workplaceParameter));
            }

            return(NotFound());
        }