Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("SubjectId,SubjectToken,SubjectName,IsDeleted,CreateDate")] Subject subject)
        {
            if (id != subject.SubjectId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subject);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubjectExists(subject.SubjectId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(subject));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ExamId,ExamToken,CenterId,SubjectId,PaperNumber,DeletedDate,DeletedByUsersId,LastModifiedByUsersId,LastModifiedDate,CreatedByUsersId,CreateDate,IsDeleted")] Exam exam)
        {
            if (id != exam.ExamId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exam);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExamExists(exam.ExamId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CenterId"]  = new SelectList(_context.Center, "CenterId", "CenterName", exam.CenterId);
            ViewData["SubjectId"] = new SelectList(_context.Subject, "SubjectId", "SubjectName", exam.SubjectId);
            return(View(exam));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, [Bind("CenterManagerId,UsersId,CenterId,CreateDate")] CenterManger centerManger)
        {
            if (id != centerManger.CenterManagerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(centerManger);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CenterMangerExists(centerManger.CenterManagerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CenterId"] = new SelectList(_context.Center, "CenterId", "CenterName", centerManger.CenterId);
            ViewData["UsersId"]  = new SelectList(_context.Users, "UsersId", "Loginname", centerManger.UsersId);
            return(View(centerManger));
        }
Exemple #4
0
        public async Task <IActionResult> Edit(int id, [Bind("MarkersId,SubjectId,CenterId,UsersId,RaceId,ExamId,GenderId,PositionId,CentreNumber,FullName,IdNumber,PhysicalAddress,PostalCode,PersalNumber,WorkTelephone,HomeTelephone,Cellphone,Latitude,Longitude,CreatedDate,CreatedByUsersId")] MarkersGpscoordinates markersGpscoordinates)
        {
            //  CHECK PERMISSIONS  -- ADD THIS CODE TO ALL YOUR PROTECTED ACTIONS
            roleID = Convert.ToInt32(_sessionAccessor.HttpContext.Session.GetInt32("roleID"));
            if (roleID <= 0)
            {
                return(Unauthorized("You are not signed in."));          //  write better message
            }
            if (roleID != (int)RoleIDs.Administrator && roleID != (int)RoleIDs.CenterManager)
            {
                return(Unauthorized("You don't have permission to perform this operation."));  //  write better message
            }
            //  END OF SECURITY CHECK



            if (id != markersGpscoordinates.MarkersId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(markersGpscoordinates);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MarkersGpscoordinatesExists(markersGpscoordinates.MarkersId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }



                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CenterId"]   = new SelectList(_context.Center, "CenterId", "CenterName", markersGpscoordinates.CenterId);
            ViewData["ExamId"]     = new SelectList(_context.Exam, "ExamId", "PaperNumber", markersGpscoordinates.ExamId);
            ViewData["GenderId"]   = new SelectList(_context.Gender, "GenderId", "GenderDescription", markersGpscoordinates.GenderId);
            ViewData["PositionId"] = new SelectList(_context.Position, "PositionId", "PositionDescription", markersGpscoordinates.PositionId);
            ViewData["RaceId"]     = new SelectList(_context.Race, "RaceId", "RaceDescription", markersGpscoordinates.RaceId);
            ViewData["SubjectId"]  = new SelectList(_context.Subject, "SubjectId", "SubjectName", markersGpscoordinates.SubjectId);
            ViewData["UsersId"]    = new SelectList(_context.Users, "UsersId", "Loginname", markersGpscoordinates.UsersId);
            return(View(markersGpscoordinates));
        }
Exemple #5
0
        public async Task <IActionResult> Edit(int id, [Bind("UsersId,RoleId,CenterId,UsersToken,Loginname,Password,GenderId,Firstname,Lastname,EmailAddress,MobileNo,Telephone,Displayname,PostalAddress,PhysicalAddress,LastModifiedByUsersId,LastModifiedDate,CreatedByUsersId,CreateDate,IsDeleted")] Users users)
        {
            //  CHECK PERMISSIONS  -- ADD THIS CODE TO ALL YOUR PROTECTED ACTIONS
            roleID = Convert.ToInt32(_sessionAccessor.HttpContext.Session.GetInt32("roleID"));
            if (roleID <= 0)
            {
                return(Unauthorized("You are not signed in."));          //  write better message
            }
            if (roleID != (int)RoleIDs.SuperAdmin)
            {
                return(Unauthorized("You don't have permission to perform this operation."));  //  write better message
            }
            //  END OF SECURITY CHECK
            if (id != users.UsersId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.UsersId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CenterId"] = new SelectList(_context.Center, "CenterId", "CenterName", users.CenterId);
            ViewData["GenderId"] = new SelectList(_context.Gender, "GenderId", "GenderDescription", users.GenderId);
            ViewData["RoleId"]   = new SelectList(_context.Role, "RoleId", "RoleDescription", users.RoleId);
            return(View(users));
        }
Exemple #6
0
        public async Task <IActionResult> Edit(int id, [Bind("CenterId,CenterToken,CenterName,Scanner,CenterNumber,CenterDescription,CityId,Longitude,Latitude,DeletedDate,DeletedByUsersId,LastModifiedByUsersId,LastModifiedDate,CreatedByUsersId,CreateDate,IsDeleted")] Center center)
        {
            //  CHECK PERMISSIONS  -- ADD THIS CODE TO ALL YOUR PROTECTED ACTIONS
            roleID = Convert.ToInt32(_sessionAccessor.HttpContext.Session.GetInt32("roleID"));
            if (roleID <= 0)
            {
                return(Unauthorized("You are not signed in."));          //  write better message
            }
            if (roleID != (int)RoleIDs.Administrator && roleID != (int)RoleIDs.SuperAdmin)
            {
                return(Unauthorized("You don't have permission to perform this operation."));  //  write better message
            }
            //  END OF SECURITY CHECK
            if (id != center.CenterId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(center);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CenterExists(center.CenterId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.City, "CityId", "CityDescription", center.CityId);
            return(View(center));
        }