public async Task <ActionResult> Action(int?id)
        {
            if (id > 0)
            {
                _Student = await Task.Run(() => _IStudentServices.GetDataById(id.Value));

                _IStudent.ID           = _Student.ID;
                _IStudent.Name         = _Student.Name;
                _IStudent.Phone        = _Student.Phone;
                _IStudent.Address      = _Student.Address;
                _IStudent.City         = _Student.City;
                _IStudent.Email        = _Student.Email;
                _IStudent.Semester     = _Student.Semester;
                _IStudent.Pictures     = _Student.StudentPictures;
                _IStudent.DepartmentID = _Student.DepartmentID;
                _IStudent.Code         = _Student.Code;
                _IStudent.Gender       = _Student.Gender;
            }
            _IStudent.Code = "STD-0001" + await Task.Run(() => _IStudentServices.TotalRowCount());

            _IStudent.Departments = await Task.Run(() => _IDepartmentServices.GetAllData());

            _IStudent.Genders = Enum.GetValues(typeof(GenderEnums)).Cast <GenderEnums>().ToList();
            return(View(_IStudent));
        }
Esempio n. 2
0
        public async Task <JsonResult> ListOfDepartment(int iDisplayLength, int iDisplayStart, int iSortCol_0, string sSortDir_0, string sSearch)
        {
            int rowNumber;
            int totalRecord;
            List <Department> deparments = new List <Department>();

            deparments = await Task.Run(() => _IDepartmentServices.GetAllData(iDisplayLength, iDisplayStart, iSortCol_0, sSortDir_0, sSearch));

            totalRecord = await Task.Run(() => _IDepartmentServices.TotalRowCount());

            rowNumber  = deparments.Count();
            deparments = deparments.Skip(iDisplayStart).Take(iDisplayLength).ToList();
            JsonResult result = new JsonResult
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = new
                {
                    iTotalRecords        = totalRecord,
                    iTotalDisplayRecords = rowNumber,
                    aaData = deparments
                }
            };

            return(result);
        }