public IActionResult AddNewMachine(NewMachineViewModel model) { IActionResult result = null; try { var newMachine = new EquipmentItem() { Name = model.Name, Description = model.Description, CategoryId = model.Category, ImageURL = model.ImageURL, VideoLink = model.VideoURL, MachineNumber = model.Number }; // Save the user account _db.AddNewMachine(newMachine); result = Ok(); } catch (Exception) { result = BadRequest(new { Message = "Failed to add machine" }); } return(result); }