public ResultDto InsertUpdate(ClusterDto cluster) { ResultDto resultDto = new ResultDto(); string obectName = "cluster"; try { ObjectParameter prmClusterID = new ObjectParameter("ClusterID", cluster.ClusterID); ObjectParameter prmClusterCode = new ObjectParameter("ClusterCode", string.Empty); int effectedRow = _dbContext.uspClusterInsertUpdate(prmClusterID, cluster.ClusterName, cluster.TEClusterName, cluster.StartDate, cluster.MandalID, cluster.BranchID, cluster.Phone, cluster.Address, cluster.Leader, cluster.LeaderFromDate, cluster.UserID, prmClusterCode); resultDto.ObjectId = (int)prmClusterID.Value; resultDto.ObjectCode = string.IsNullOrEmpty((string)prmClusterCode.Value) ? cluster.ClusterCode : (string)prmClusterCode.Value; if (resultDto.ObjectId > 0) { resultDto.Message = string.Format("{0} details saved successfully with code : {1}", obectName, resultDto.ObjectCode); } else if (resultDto.ObjectId == -1) { resultDto.Message = string.Format("Error occured while generating {0} code", obectName); } else { resultDto.Message = string.Format("Error occured while saving {0} details", obectName); } } catch (Exception) { resultDto.Message = string.Format("Service layer error occured while saving the {0} details", obectName); resultDto.ObjectId = -98; } return(resultDto); }