public ActionResult Create(Company company, HttpPostedFileBase Logo)
        {
            if (Session["ComID"] != null)
            {
                if (ModelState.IsValid)
                {
                    string path = Server.MapPath("~/Logo/");
                    try
                    {
                        //Upload Logo
                        if (Logo != null)
                        {
                           Logo.SaveAs(path + company.Logo);

                        }
                    }
                    catch
                    {
                        // return RedirectToAction("Error", "Home", new { @ErrorMsg = "Error" });
                    }
                    db.Companies.Add(company);
                    db.SaveChanges();
                    string username = Session["ComName"].ToString();

                    //Account Confirmation
                    string confirmtoken = Session["Comtoken"].ToString();
                    WebSecurity.ConfirmAccount(username, confirmtoken);

                    //Add Company to Roles
                    Roles.AddUserToRole(username, "Company");

                    //Log in
                    WebSecurity.Login(username, company.Password);
                    Session["companyID"] = company.CompId;
                    Session["CID"] = company.ID;
                    return RedirectToAction("Details", "Company", new { id = company.ID });
                }

                ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", company.CountryId);
                return View(company);
            }
            else
                return RedirectToAction("Registeration", "Account", null);
        }
 public ActionResult Edit(Company company)
 {
     if (ModelState.IsValid)
     {
         db.Entry(company).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Details", "Company", new { id = company.ID});
     }
     ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", company.CountryId);
     return View(company);
 }