Exemplo n.º 1
0
        public async Task <IHttpActionResult> AssignAllTaskForMachineById([FromUri] int id, [FromBody] MaintenanceTaskAssign model)
        {
            //check if model is valid
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState)); //404
            }

            //instantiate service
            MachineService service = CreateMachineService();

            //check if updated
            if (await service.AssignAllTaskForMachineById(id, model) == false)
            {
                return(InternalServerError());
            }

            return(Ok("All Tasks Assigned")); //200 with custom message
        }