Example #1
0
        private void AddOrUpdate(StudentDetail item)
        {
            var saveItem = _id == ""
                ? _repo.AddStudent(item)
                : _repo.UpdateStudent(item);

            if (saveItem == string.Empty)
            {
                Base.ShowSuccess("Success", "Student saved successfully");
                this.Close();
            }
            else
            {
                Base.ShowError("Failed", saveItem);
            }
        }
Example #2
0
        public ActionResult Create(Student std)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    StudentRepo repo = new StudentRepo();

                    repo.AddStudent(std);
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }