public JsonResult ValidateGroupName(string groupName, long groupId = 0)
{
SubjectManager subjectManager = new SubjectManager();
Group group = subjectManager.GetGroupByName(groupName);
if (group == null)
{
return Json(true, JsonRequestBehavior.AllowGet);
}
else
{
if (group.Id == groupId)
{
return Json(true, JsonRequestBehavior.AllowGet);
}
else
{
string error = String.Format(CultureInfo.InvariantCulture, "The group name already exists.", groupName);
return Json(error, JsonRequestBehavior.AllowGet);
}
}
}