public decimal?Add(QoalaEntities context) { if (emailAlreadyExist(context, EMAIL)) { throw new UserEmailExistsException(); } var outParameter = new ObjectParameter("OUT_ID_USER", typeof(decimal)); if (!(PERMISSION > 0 && PERMISSION <= 4)) { PERMISSION = 1; } int ret = context.SP_INSERT_USER(NAME, PASSWORD, EMAIL, PERMISSION, ADDRESS, DISTRICT, CITY, STATE, ZIPCODE, outParameter); if (outParameter.Value == DBNull.Value) { ID_USER = 0m; } else { ID_USER = (Decimal)outParameter.Value; } context.Entry(this).State = EntityState.Unchanged; return(ID_USER); }