public ActionResult ManageSchoolForm(School school)
        {
            School _school = new School();
            _school.Name = school.Name;
            _school.Country = string.IsNullOrEmpty(school.Country) ? string.Empty : school.Country;
            _school.City = string.IsNullOrEmpty(school.City) ? string.Empty : school.City;
            _school.LogoPath = string.IsNullOrEmpty(school.LogoPath) ? string.Empty : school.LogoPath;

            if (school.ID == Guid.Empty)
            {
                school.ID = Guid.NewGuid();
                int isAdded = _BSchool.Add(school);
                if (isAdded != 0)
                {
                    return Json(new { success = true, message = "School added successfully", status = true });
                }
                return Json(new { success = true, message = "School Name already exist", status = false });
            }
            else
            {
                school.ID = school.ID;
                _BSchool.Update(school);
                return Json(new { success = true, message = "School edit successfully", status = true });
            }
        }
Beispiel #2
0
 public void Remove(School obj)
 {
     SchoolRepository.Remove(obj);
 }
Beispiel #3
0
 public void Update(School obj)
 {
     SchoolRepository.Update(obj);
 }
Beispiel #4
0
 public int Add(School obj)
 {
     return SchoolRepository.Add(obj);
 }