func RestoreFromCompleteFunc(w http.ResponseWriter, r *http.Request) {
	if r.Method != "GET" {
		http.Redirect(w, r, "/", http.StatusBadRequest)
		return
	}
	id, err := strconv.Atoi(r.URL.Path[len("/incomplete/"):])
	if err != nil {
		log.Println(err)
		http.Redirect(w, r, "/completed", http.StatusBadRequest)
	} else {
		username := sessions.GetCurrentUserName(r)
		err = db.RestoreTaskFromComplete(username, id)
		if err != nil {
			message = "Restore failed"
		} else {
			message = "Task restored"
		}
		http.Redirect(w, r, "/completed", http.StatusFound)
	}
}
RestoreFromCompleteFunc restores the task from complete to pending
package views
import (
	"log"
	"net/http"
	"strconv"
	"github.com/thewhitetulip/Tasks/db"
	"github.com/thewhitetulip/Tasks/sessions"
	"github.com/thewhitetulip/Tasks/utils"
)
func TrashTaskFunc(w http.ResponseWriter, r *http.Request) {
	redirectURL := utils.GetRedirectUrl(r.Referer())
	if r.Method != "GET" {
		http.Redirect(w, r, "/", http.StatusBadRequest)
		return
	}
	id, err := strconv.Atoi(r.URL.Path[len("/trash/"):])
	if err != nil {
		log.Println("TrashTaskFunc", err)
		message = "Incorrect command"
		http.Redirect(w, r, redirectURL, http.StatusFound)
	} else {
		username := sessions.GetCurrentUserName(r)
		err = db.TrashTask(username, id)
		if err != nil {
			message = "Error trashing task"
		} else {
			message = "Task trashed"
		}
		http.Redirect(w, r, redirectURL, http.StatusFound)
	}
}
func RestoreTaskFunc(w http.ResponseWriter, r *http.Request) {
	if r.Method != "GET" {
		http.Redirect(w, r, "/", http.StatusBadRequest)
		return
	}
	id, err := strconv.Atoi(r.URL.Path[len("/restore/"):])
	if err != nil {
		log.Println(err)
		http.Redirect(w, r, "/deleted", http.StatusBadRequest)
	} else {
		username := sessions.GetCurrentUserName(r)
		err = db.RestoreTask(username, id)
		if err != nil {
			message = "Restore failed"
		} else {
			message = "Task restored"
		}
		http.Redirect(w, r, "/deleted/", http.StatusFound)
	}
}
func DeleteTaskFunc(w http.ResponseWriter, r *http.Request) {
	username := sessions.GetCurrentUserName(r)
	if r.Method != "GET" {
		http.Redirect(w, r, "/", http.StatusBadRequest)
		return
	}
	id := r.URL.Path[len("/delete/"):]
	if id == "all" {
		err := db.DeleteAll(username)
		if err != nil {
			message = "Error deleting tasks"
			http.Redirect(w, r, "/", http.StatusInternalServerError)
		}
		http.Redirect(w, r, "/", http.StatusFound)
	} else {
		id, err := strconv.Atoi(id)
		if err != nil {
			log.Println(err)
			http.Redirect(w, r, "/", http.StatusBadRequest)
		} else {
			err = db.DeleteTask(username, id)
			if err != nil {
				message = "Error deleting task"
			} else {
				message = "Task deleted"
			}
			http.Redirect(w, r, "/deleted", http.StatusFound)
		}
	}
}