public JsonResult UpdateProspective(string Username, string[] listids) { string str = ""; try { var result = string.Join(",", listids); var UserPros = context.UserProspectingLists.Where(x => x.UserId == Username); if (UserPros.Count() == 0) { context.SpInsertUserPRos(Username, result); context.SaveChanges(); str = "Record Saved"; } else { context.SpUpdateUserPRos(Username, result); context.SaveChanges(); str = "Record Inserted"; } } catch (Exception ex) { cm.ErrorExceptionLogingByService(ex.ToString(), "ManageUser" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "UpdateProspective", "NA", "NA", "NA", "WEB"); str = "Error"; } return(Json(str, JsonRequestBehavior.AllowGet)); }