public static string DeleteCompany(int paramComId) { string latestSaveCode = string.Empty; try { using (var db = new MarkomApplicationDBEntities()) { //latestSaveCode = db.m_company.Where(x => x.id == paramComId).SingleOrDefault()?.name; // ?. will prevent the code from throwing a null-reference exception and will return null when a point with Id does not exist ObjectParameter returnId = new ObjectParameter("Code", typeof(string)); //Create Object parameter to receive a output value.It will behave like output parameter db.spCompanyDelete(paramComId, returnId); //calling our entity imported function "Bangalore" is our input parameter, returnId is a output parameter, it will receive the output value latestSaveCode = (String)returnId.Value; } } catch (Exception ex) { Message = ex.Message; } return(latestSaveCode); }