public ActionResult EditEmployee(Data.DTOs.EmployeeDto model)
 {
     try
     {
         Data.Entities.Employees.EditEmployee(model.EmployeeId, model.Name, model.Email, model.Mobile, model.Role);
         return(RedirectToAction("Profile", model.EmployeeId));
     }
     catch (Exception e)
     {
         return(RedirectToAction("Error", "Login"));
     }
 }
 public ActionResult EditEmployee(int empId)
 {
     try
     {
         Data.DTOs.EmployeeDto model = Data.DTOs.EmployeeDto.Load(empId);
         //TODO ovde nema view
         return(View(model));
     }
     catch (Exception e)
     {
         return(RedirectToAction("Error", "Login"));
     }
 }
 //all
 public ActionResult Profile(int id)
 {
     try
     {
         if (UserSession.CheckUserID(id) || UserSession.IfAdmin())
         {
             Data.DTOs.EmployeeDto model = Data.DTOs.EmployeeDto.Load(id);
             return(View(model));
         }
         return(RedirectToAction("Unauthorized", "Login"));
     }
     catch (Exception e)
     {
         return(RedirectToAction("Error", "Login"));
     }
 }
        public async Task <ActionResult> AddEmployee(Data.DTOs.EmployeeDto model)
        {
            try
            {
                string pass       = Data.Entities.Employees.RandomString(7);
                string hashedPass = Data.Entities.HashPassword.SaltedHashPassword(pass, model.Email);
                Data.Entities.Employees.AddEmployee(model.Name, model.Email, hashedPass, model.Role);

                string body =
                    "<p>Poštovani {0},</p> <p> Upravo ste dodati u bazu Crafted Food radi lakšeg naručivanja hrane kao <strong>{1}</strong>, Vaši podaci za logovanje su: <br> username: {2} <br>  password: <font color=blue>{3}</p><p>Srdačno, <br>Vatrene školjke</p>";
                string message = string.Format(body, model.Name, model.Role, model.Email, pass);
                await SendEmail(model.Email, "Welcome to Craft Food", message);

                return(View());
            }
            catch (Exception e)
            {
                return(RedirectToAction("Error", "Login"));
            }
        }
 public ActionResult Profile(Data.DTOs.EmployeeDto model)
 {
     try
     {
         if (UserSession.CheckUserID(model.EmployeeId) || UserSession.IfAdmin())
         {
             Data.Entities.Employees.EditEmployee(model.EmployeeId, model.Name, model.Email, model.Mobile, model.Role);
             if (!UserSession.IfAdmin())
             {
                 return(RedirectToAction("Index", "Menu"));
             }
             return(RedirectToAction("Index"));
         }
         return(RedirectToAction("Unauthorized", "Login"));
     }
     catch (Exception e)
     {
         return(RedirectToAction("Error", "Login"));
     }
 }