public bool doesTextIdExist(AdminInput input) { var id = Convert.ToDecimal(input.Id); if (input.Id == 0) { var text = ITranslation.GetText().Where(x => x.TextId == input.TextId).FirstOrDefault(); if (text != null) { //ViewBag.errormsg += input.TextId + " TextId already exist.\n"; ViewBag.errormsg = "Records already exist."; return(true); } else { return(false); } } else { var text = ITranslation.GetText().Where(x => x.TextId == input.TextId && x.Id != id).FirstOrDefault(); if (text != null) { //ViewBag.errormsg += input.TextId + "TextId already exist."; ViewBag.errormsg = "Records already exist."; return(true); } else { return(false); } } }