示例#1
0
        public IActionResult Edit(UIPathStudent student)
        {
            if (ModelState.IsValid)
            {
                student.FirstName = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(student.FirstName);
                student.LastName  = student.LastName.ToUpper();
                student.Mail      = student.Mail.ToLower();

                _uipathStudentRepository.Update(student);

                return(RedirectToAction("List"));
            }
            ViewBag.GroupId = new SelectList(_groupRepository.Groups, "Id", "GroupName");
            return(View(student));
        }
示例#2
0
        public IActionResult Create(UIPathStudent student)
        {
            if (ModelState.IsValid)
            {
                if (_uipathStudentRepository.Students.Any(x => x.Phone == student.Phone))
                {
                    return(View("Error", "Telefon Numarası Daha Önce Kaydedilmiştir!"));
                }
                if (_uipathStudentRepository.Students.Any(x => x.Mail == student.Mail))
                {
                    return(View("Error", "Mail Adresi Daha Önce Kaydedilmiştir!"));
                }

                student.FirstName = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(student.FirstName);
                student.LastName  = student.LastName.ToUpper();
                student.Mail      = student.Mail.ToLower();

                _uipathStudentRepository.Add(student);

                return(RedirectToAction("Create"));
            }
            return(View(student));
        }