//CRUD UPDATE //POST an update to the db //error checking //POST: /TSTaskWorkOrder/UpdateTaskWO public string UpdateTaskWO(TSTaskWorkOrderModel tsTaskWorkOrder) { try { //create a new TaskWO-type object called oTaskWO TaskWO oTaskWO = new TaskWO(); //populate the DAL-object with the MVC object data //populate the DAL-object with the MVC object data oTaskWO.Task_WO_ID = tsTaskWorkOrder.Task_WO_ID; oTaskWO.TaskType = tsTaskWorkOrder.TaskType; oTaskWO.ExpenseType = tsTaskWorkOrder.ExpenseType; oTaskWO.TaskDescription = tsTaskWorkOrder.TaskDescription; oTaskWO.TaskPurpose = tsTaskWorkOrder.TaskPurpose; oTaskWO.Active = tsTaskWorkOrder.Active; //connect via interface to DAL App, and insert the object itsApp.UpdateTaskWO(oTaskWO); return("Updated"); } catch { return("Not Updated"); } }
//inserts/creates a Task/Work Order object in the DAL->db //POST: /TSTaskWorkOrder/InsertTaskWO public string InsertTaskWO(TSTaskWorkOrderModel tsTaskWorkOrder) { //if the object has data, insert the data, else if there is no data just return a string try { //create a new DAL-based TaskWO-type object called oTaskWO TaskWO oTaskWO = new TaskWO(); //populate the DAL-object with the MVC object data oTaskWO.Task_WO_ID = tsTaskWorkOrder.Task_WO_ID; oTaskWO.TaskType = tsTaskWorkOrder.TaskType; oTaskWO.ExpenseType = tsTaskWorkOrder.ExpenseType; oTaskWO.TaskDescription = tsTaskWorkOrder.TaskDescription; oTaskWO.TaskPurpose = tsTaskWorkOrder.TaskPurpose; oTaskWO.Active = tsTaskWorkOrder.Active; //connect via interface to DAL App, and insert the object itsApp.InsertTaskWO(oTaskWO); return("Added"); } catch { return("Not Added"); } }
//CRUD DELETE //POST a deletion to the db //error checking //POST: /TSTaskWorkOrder/DeleteTaskWO public string DeleteTaskWO(TSTaskWorkOrderModel tsTaskWorkOrder) { try { //create a new TaskWO-type object called oTaskWO TaskWO oTaskWO = new TaskWO(); //populate the DAL-object with the MVC object data oTaskWO.Task_WO_ID = tsTaskWorkOrder.Task_WO_ID; oTaskWO.TaskType = tsTaskWorkOrder.TaskType; oTaskWO.ExpenseType = tsTaskWorkOrder.ExpenseType; oTaskWO.TaskDescription = tsTaskWorkOrder.TaskDescription; oTaskWO.TaskPurpose = tsTaskWorkOrder.TaskPurpose; oTaskWO.Active = tsTaskWorkOrder.Active; //connect via interface to DAL App, and delete the object. The DAL parses out just the equipment number, deleting the object with that number itsApp.DeleteTaskWO(oTaskWO); return("Deleted"); } catch { return("Not Deleted"); } }