public async Task <ActionResult> DeleteConfirmed(int id)
        {
            CollegeEmployees collegeEmployees = await db.CollegeEmployees.FindAsync(id);

            db.CollegeEmployees.Remove(collegeEmployees);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        //[Authorize]
        public ActionResult EmployeeProfile()
        {
            CollegeEmployees employee = db.CollegeEmployees.Find(user.RegistrationNo);

            if (employee != null)
            { //here problem designation solved
                var getdesig = (from alias in db.CollegeEmployees where alias.Id == user.RegistrationNo select alias.DesignationId).FirstOrDefault();
                var getname  = (from alias in db.employeeDesignationCategory where alias.Id == getdesig select alias.DesignationName).FirstOrDefault();
                TempData["name"] = getname;
                return(View(employee));
            }
            return(View());
        }
        // GET: CollegeEmployees/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CollegeEmployees collegeEmployees = await db.CollegeEmployees.FindAsync(id);

            if (collegeEmployees == null)
            {
                return(HttpNotFound());
            }
            return(View(collegeEmployees));
        }
        // GET: CollegeEmployees/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CollegeEmployees collegeEmployees = await db.CollegeEmployees.FindAsync(id);

            TempData["show"] = collegeEmployees.Uploadimage;
            if (collegeEmployees == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DesignationId = new SelectList(db.employeeDesignationCategory, "Id", "DesignationName", collegeEmployees.DesignationId);
            return(View(collegeEmployees));
        }
        // GET: CollegeEmployees/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CollegeEmployees collegeEmployees = await db.CollegeEmployees.FindAsync(id);

            if (collegeEmployees == null)
            {
                return(HttpNotFound());
            }
            int    d       = collegeEmployees.DesignationId;
            string desname = db.employeeDesignationCategory.Where(m => m.Id == d).Select(m => m.DesignationName).FirstOrDefault();

            TempData["DesignationEmployee"] = desname;
            return(View(collegeEmployees));
        }
        public async Task <ActionResult> Create(HttpPostedFileBase ImageFile, /*[Bind(Include = "Id,EmployeeName,FatherName,Address,ContactInfo,Status,JoiningDate,DesignationId")]*/ CollegeEmployees collegeEmployees)
        {
            if (ModelState.IsValid)
            {
                if (ImageFile != null)
                {
                    string fileName  = Path.GetFileNameWithoutExtension(collegeEmployees.ImageFile.FileName);
                    string extension = Path.GetExtension(collegeEmployees.ImageFile.FileName);

                    fileName = fileName + DateTime.Now.ToString("yymmssff") + extension;
                    collegeEmployees.Uploadimage = "~/image/" + fileName;
                    collegeEmployees.ImageFile.SaveAs(Path.Combine(Server.MapPath("~/image/"), fileName));
                }

                db.CollegeEmployees.Add(collegeEmployees);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.DesignationId = new SelectList(db.employeeDesignationCategory, "Id", "DesignationName", collegeEmployees.DesignationId);
            return(View(collegeEmployees));
        }