public ActionResult Create(DepartmentViewModel department)
        {
            if(department.Image.ContentLength > (2 * 1024 * 1024))
            {
                ModelState.AddModelError("CustomError", "Filen skal være mindre end 2 MB");
                return View(department);
            }

            if (!(department.Image.ContentType == "image/jpeg" || department.Image.ContentType == "image/gif"))
            {
                ModelState.AddModelError("CustomError", "Tillate fil typer jpeg og gif");
                return View(department);
            }

            if (ModelState.IsValid)
            {
                byte[] data = new byte[department.Image.ContentLength];
                department.Image.InputStream.Read(data, 0, department.Image.ContentLength);

                department.ImageData = data;

                Department newDepartment = new Department()
                {
                    Name = department.Name,
                    ImageData = department.ImageData,
                };

                Facade.GetDepartmentGateway().Create(newDepartment);
                return RedirectToAction("Index");
            }
            return View(department);
        }
 public ActionResult Delete(int id, Department department)
 {
     try
     {
         Facade.GetDepartmentGateway().Delete(id);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
 public ActionResult Edit(Department department)
 {
     if (ModelState.IsValid)
     {
         Facade.GetDepartmentGateway().Update(department);
         return RedirectToAction("Index");
     }
     return View(department);
 }