private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (PassedValidation())
                {
                    var model = new Course()
                    {
                        DepartmentId = int.Parse(drpdownDept.SelectedValue.ToString()),
                        CourseTitle = txtCourseTitle.Text.ToTitleCase(),
                        CourseCode = txtCourseCode.Text.ToUpper()
                    };

                    string response;
                    if (lblId.Text == string.Empty) //add
                    {
                        response = _courseRepo.AddCourse(model);
                        if (response == string.Empty)
                        {
                            MessageBox.Show(this, "Course added successfully", "Success",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                            ClearControls();
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show(this, response, "Failed", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                        }
                    }
                    else //update
                    {
                        model.Id = int.Parse(lblId.Text);
                        response = _courseRepo.UpdateCourse(model);
                        if (response == string.Empty)
                        {
                            MessageBox.Show(this, "Course updated successfully", "Success",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                            ClearControls();
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show(this, response, "Failed", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error occured", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
        private void AddOrUpdate(Course item)
        {
            var saveItem = _id == ""
                ? _repo.AddCourse(item)
                : _repo.UpdateCourse(item);

            if (saveItem == string.Empty)
            {
                Base.ShowSuccess("Success", "Course saved successfully");
                this.Close();
            }
            else
            {
                Base.ShowError("Failed", saveItem);
            }
        }
        public ActionResult EditCouDetails(int id, CourseModel obj)
        {
            if (Session["UserId"] != null && Session["Accountid"] != null)
            {
                try
                {
                    CourseRepo CouRepo = new CourseRepo();

                    CouRepo.UpdateCourse(obj);

                    return(RedirectToAction("GetAllCourse"));
                }
                catch
                {
                    return(View());
                }
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }