Beispiel #1
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Name")] JobType jobType)
        {
            if (ModelState.IsValid)
            {
                db.JobTypes.Add(jobType);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(jobType));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,Institute,Degree,Result,PassingYear,Board,EmployeeId")] Education education)
        {
            if (ModelState.IsValid)
            {
                db.Educations.Add(education);
                await db.SaveChangesAsync();

                return(RedirectToAction("Create"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName", education.EmployeeId);
            return(View(education));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,House_Road,PoliceStation,PostOffice,District,EmployeeId")] Address address)
        {
            if (ModelState.IsValid)
            {
                db.Addresses.Add(address);
                await db.SaveChangesAsync();

                // return Redirect(Url.Action("Create", "Educations"));
                return(RedirectToAction("Create"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName", address.EmployeeId);
            return(View(address));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,FirstName,LastName,DOB,Phone,Email,Nationality,NID,PhotoPath,JobTypeId")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
                // return Redirect(Url.Action("Create", "Addresses"));
            }

            ViewBag.JobTypeId = new SelectList(db.JobTypes, "Id", "Name", employee.JobTypeId);
            return(View(employee));
        }
        public async Task <ActionResult> Create([Bind(Include = "UserId,password,UserTypeId,EmployeeId")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName", user.EmployeeId);
            ViewBag.UserTypeId = new SelectList(db.UserTypes, "Id", "Name", user.UserTypeId);
            return(View(user));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,EmployeeId,Time,Date,Type")] Attendance attendance)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string   time  = DateTime.Now.ToString();
                    string[] phase = time.Split(' ');
                    attendance.Date = phase[0];
                    attendance.Time = phase[1] + ' ' + phase[2];
                }
                catch { }
                db.Attendances.Add(attendance);
                await db.SaveChangesAsync();

                return(RedirectToAction("Create"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName", attendance.EmployeeId);
            return(View(attendance));
        }